kwslogger


Namekwslogger JSON
Version 0.3.2 PyPI version JSON
download
home_pagehttps://github.com/kWAYTV/kwslogger
SummaryMy own logging library so i don't need to port it to every single project i make.
upload_time2023-11-10 17:22:45
maintainer
docs_urlNone
authorkWAY
requires_python
license
keywords python logging kwslogger
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 📚 kwslogger: Your Custom Logging Solution! 🚀
Welcome to `kwslogger`, a tailored logging solution for Python developers who desire more color and style in their logs.

## 🌟 Features
- 🎨 Colorful logs to easily differentiate log types.
- 📅 Timestamped logs to understand when events occur.
- 📝 Write your logs to a file with ease.
- ⛔ Filter out logs with the log levels.
- 📈 Progress bar & spinner support.
- 🤖 ASCII logo creation with just 1 call.
- 🧑‍💻 Generate QR codes easily.

## ⚙️ Installation
```bash
pip install kwslogger
```

## 🤖 Documentation
[Click me](https://docs.kwayservices.top/kwslogger/) to go to the library docs.

## 🚀 Usage

Normal logs for your tools
```python
from kwslogger import Logger

# Create a logger instance
logger = Logger(log_level="ANY", log_to_file=True, log_file_name="mylogs", log_file_mode="a")

# Clear the console
logger.clear()

# Log a message
logger.welcome("I'm a welcome message!")
logger.info("I'm an info message!")
logger.debug("I'm a debug message!")
logger.success("I'm a success message!")
logger.warning("I'm a warning!")
logger.error("I'm an error!")
logger.input("I'm an input message!")
logger.ratelimit("I'm a rate limit message!")
```

Animated Sleeps
```python
from kwslogger import Logger

# Create a logger instance
logger = Logger()

logger.sleep("Waiting for 1 second...", 1)
```

Run functions while you showing the spinner with an optional timer
```python
from kwslogger import Logger

# Create a logger instance
logger = Logger()

def test_func(number1, number2):
    answer = number1 + number2
    return answer

result = logger.run_with_spinner(test_func, "Calculating...", True, 1, 1)
print(str(result) + " (Func returned)")
```

Filter out your logs with the built in log levels, anything above the level you set on the logger instace won't be logged nor written to the file.
```text
debug (0) --> info (1) --> welcome (2) --> success (3) --> warning (4) --> error (5) --> input (6) --> ratelimit (7) --> sleep (8) --> any (9)
```
Example:
```python

from kwslogger import Logger

# Create a logger instance
logger = Logger(log_level="WARNING", log_to_file=True, log_file_name="mylogs", log_file_mode="a")

print(logger.can_log("INFO")) # --> True because it's below warning level. Would log and write to the file.
print(logger.can_log("RATELIMIT")) # --> False because it's above the warning level. Wouldn't log nor write to the file.
```
You don't need to filter out the logs with this method, it's done automatically, this is just an example and a method added to check whether a log should be logged or not.

Create progress bars with ease.
```python
import time
from kwslogger import Logger

logger = Logger()

for i in (logger.progress_bar(range(100), desc="Progress Bar", unit="items", unit_scale=True, unit_divisor=100, miniters=1, mininterval=0.1, maxinterval=1, dynamic_ncols=True, smoothing=0.3, bar_format="{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}]", leave=False)):
    time.sleep(0.1)
```
You can add as many arguments and customizations as the tqdm library supports.

Create logos with just 1 function
```python
from kwslogger import Logger

logger = Logger()

logger.create_logo("Pluto Reportbot")
```
You can use a custom `pyfiglet` font with the following
```python
logger.create_logo("Pluto Reportbot", font = "slant")
```

Generate QR Codes with 1 call
```python
from kwslogger import Logger

logger = Logger()

logger.generate_qr("https://hvh.bio/")
```

## 🤝 Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/kWAYTV/kwslogger/issues).

## 💖 Support
If you like this project, please give it a ⭐️ and share it with your friends!

## 📝 Dependencies
Those are the libraries we use for the logger! Thanks to all of them 🤍
- [yaspin](https://github.com/pavdmyt/yaspin)
- [tqdm](https://github.com/tqdm/tqdm)
- [colorama](https://github.com/tartley/colorama)
- [pyfiglet](https://github.com/pwaller/pyfiglet)
- [pystyle](https://github.com/billythegoat356/pystyle)

## 📄 License
This project is [MIT](https://opensource.org/licenses/MIT) licensed, [click here](LICENSE) to see the license file.

---

Thanks for choosing `kwslogger` for your logging needs!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kWAYTV/kwslogger",
    "name": "kwslogger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,logging,kwslogger",
    "author": "kWAY",
    "author_email": "admin@kwayservices.top",
    "download_url": "https://files.pythonhosted.org/packages/b8/8e/5b2a62c6eb9904e63d20330d92a7ae2c60f7738737ca44744c0a81cdb806/kwslogger-0.3.2.tar.gz",
    "platform": null,
    "description": "# \ud83d\udcda kwslogger: Your Custom Logging Solution! \ud83d\ude80\nWelcome to `kwslogger`, a tailored logging solution for Python developers who desire more color and style in their logs.\n\n## \ud83c\udf1f Features\n- \ud83c\udfa8 Colorful logs to easily differentiate log types.\n- \ud83d\udcc5 Timestamped logs to understand when events occur.\n- \ud83d\udcdd Write your logs to a file with ease.\n- \u26d4 Filter out logs with the log levels.\n- \ud83d\udcc8 Progress bar & spinner support.\n- \ud83e\udd16 ASCII logo creation with just 1 call.\n- \ud83e\uddd1\u200d\ud83d\udcbb Generate QR codes easily.\n\n## \u2699\ufe0f Installation\n```bash\npip install kwslogger\n```\n\n## \ud83e\udd16 Documentation\n[Click me](https://docs.kwayservices.top/kwslogger/) to go to the library docs.\n\n## \ud83d\ude80 Usage\n\nNormal logs for your tools\n```python\nfrom kwslogger import Logger\n\n# Create a logger instance\nlogger = Logger(log_level=\"ANY\", log_to_file=True, log_file_name=\"mylogs\", log_file_mode=\"a\")\n\n# Clear the console\nlogger.clear()\n\n# Log a message\nlogger.welcome(\"I'm a welcome message!\")\nlogger.info(\"I'm an info message!\")\nlogger.debug(\"I'm a debug message!\")\nlogger.success(\"I'm a success message!\")\nlogger.warning(\"I'm a warning!\")\nlogger.error(\"I'm an error!\")\nlogger.input(\"I'm an input message!\")\nlogger.ratelimit(\"I'm a rate limit message!\")\n```\n\nAnimated Sleeps\n```python\nfrom kwslogger import Logger\n\n# Create a logger instance\nlogger = Logger()\n\nlogger.sleep(\"Waiting for 1 second...\", 1)\n```\n\nRun functions while you showing the spinner with an optional timer\n```python\nfrom kwslogger import Logger\n\n# Create a logger instance\nlogger = Logger()\n\ndef test_func(number1, number2):\n    answer = number1 + number2\n    return answer\n\nresult = logger.run_with_spinner(test_func, \"Calculating...\", True, 1, 1)\nprint(str(result) + \" (Func returned)\")\n```\n\nFilter out your logs with the built in log levels, anything above the level you set on the logger instace won't be logged nor written to the file.\n```text\ndebug (0) --> info (1) --> welcome (2) --> success (3) --> warning (4) --> error (5) --> input (6) --> ratelimit (7) --> sleep (8) --> any (9)\n```\nExample:\n```python\n\nfrom kwslogger import Logger\n\n# Create a logger instance\nlogger = Logger(log_level=\"WARNING\", log_to_file=True, log_file_name=\"mylogs\", log_file_mode=\"a\")\n\nprint(logger.can_log(\"INFO\")) # --> True because it's below warning level. Would log and write to the file.\nprint(logger.can_log(\"RATELIMIT\")) # --> False because it's above the warning level. Wouldn't log nor write to the file.\n```\nYou don't need to filter out the logs with this method, it's done automatically, this is just an example and a method added to check whether a log should be logged or not.\n\nCreate progress bars with ease.\n```python\nimport time\nfrom kwslogger import Logger\n\nlogger = Logger()\n\nfor i in (logger.progress_bar(range(100), desc=\"Progress Bar\", unit=\"items\", unit_scale=True, unit_divisor=100, miniters=1, mininterval=0.1, maxinterval=1, dynamic_ncols=True, smoothing=0.3, bar_format=\"{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}]\", leave=False)):\n    time.sleep(0.1)\n```\nYou can add as many arguments and customizations as the tqdm library supports.\n\nCreate logos with just 1 function\n```python\nfrom kwslogger import Logger\n\nlogger = Logger()\n\nlogger.create_logo(\"Pluto Reportbot\")\n```\nYou can use a custom `pyfiglet` font with the following\n```python\nlogger.create_logo(\"Pluto Reportbot\", font = \"slant\")\n```\n\nGenerate QR Codes with 1 call\n```python\nfrom kwslogger import Logger\n\nlogger = Logger()\n\nlogger.generate_qr(\"https://hvh.bio/\")\n```\n\n## \ud83e\udd1d Contributing\nContributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/kWAYTV/kwslogger/issues).\n\n## \ud83d\udc96 Support\nIf you like this project, please give it a \u2b50\ufe0f and share it with your friends!\n\n## \ud83d\udcdd Dependencies\nThose are the libraries we use for the logger! Thanks to all of them \ud83e\udd0d\n- [yaspin](https://github.com/pavdmyt/yaspin)\n- [tqdm](https://github.com/tqdm/tqdm)\n- [colorama](https://github.com/tartley/colorama)\n- [pyfiglet](https://github.com/pwaller/pyfiglet)\n- [pystyle](https://github.com/billythegoat356/pystyle)\n\n## \ud83d\udcc4 License\nThis project is [MIT](https://opensource.org/licenses/MIT) licensed, [click here](LICENSE) to see the license file.\n\n---\n\nThanks for choosing `kwslogger` for your logging needs!\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "My own logging library so i don't need to port it to every single project i make.",
    "version": "0.3.2",
    "project_urls": {
        "Homepage": "https://github.com/kWAYTV/kwslogger"
    },
    "split_keywords": [
        "python",
        "logging",
        "kwslogger"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73f38ed8b01d7c4b7b497b5701be4c88a7610df96e4acc509b64ac55faa39dee",
                "md5": "6db3d896d82a649fb6439d4dc6a861e0",
                "sha256": "6e7458360f49d03e4d157b78ad042b819c77b9b1d3c04d29e6ac49b9dae21cda"
            },
            "downloads": -1,
            "filename": "kwslogger-0.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6db3d896d82a649fb6439d4dc6a861e0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10618,
            "upload_time": "2023-11-10T17:22:29",
            "upload_time_iso_8601": "2023-11-10T17:22:29.319926Z",
            "url": "https://files.pythonhosted.org/packages/73/f3/8ed8b01d7c4b7b497b5701be4c88a7610df96e4acc509b64ac55faa39dee/kwslogger-0.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b88e5b2a62c6eb9904e63d20330d92a7ae2c60f7738737ca44744c0a81cdb806",
                "md5": "ea5602e2dd915fd9922293f2d9ad47cf",
                "sha256": "f0ffda3951a65e730493d96de4fadfbb52cf77b27d0a0d11ed4696d682fb03bb"
            },
            "downloads": -1,
            "filename": "kwslogger-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ea5602e2dd915fd9922293f2d9ad47cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10034,
            "upload_time": "2023-11-10T17:22:45",
            "upload_time_iso_8601": "2023-11-10T17:22:45.479051Z",
            "url": "https://files.pythonhosted.org/packages/b8/8e/5b2a62c6eb9904e63d20330d92a7ae2c60f7738737ca44744c0a81cdb806/kwslogger-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-10 17:22:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kWAYTV",
    "github_project": "kwslogger",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "kwslogger"
}
        
Elapsed time: 2.79540s