Skip to main content

📚 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

pip install kwslogger

🤖 Documentation

Click me to go to the library docs.

🚀 Usage

Normal logs for your tools

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

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

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.

debug (0) --> info (1) --> welcome (2) --> success (3) --> warning (4) --> error (5) --> input (6) --> ratelimit (7) --> sleep (8) --> any (9)

Example:

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.

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

from kwslogger import Logger

logger = Logger()

logger.create_logo("Pluto Reportbot")

You can use a custom pyfiglet font with the following

logger.create_logo("Pluto Reportbot", font = "slant")

Generate QR Codes with 1 call

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.

💖 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 🤍

📄 License

This project is MIT licensed, click here to see the license file.


Thanks for choosing kwslogger for your logging needs!

Metadata

Release files for kwslogger 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kwslogger 0.3.2
File Size Uploaded
kwslogger-0.3.2.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kwslogger 0.3.2
File Interpreter ABI Platform
kwslogger-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / kwslogger-0.3.2.tar.gz

Download URL kwslogger-0.3.2.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f0ffda3951a65e730493d96de4fadfbb52cf77b27d0a0d11ed4696d682fb03bb
BLAKE2b-256 checksum
How to use checksums
b88e5b2a62c6eb9904e63d20330d92a7ae2c60f7738737ca44744c0a81cdb806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / kwslogger-0.3.2-py3-none-any.whl

Download URL kwslogger-0.3.2-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e7458360f49d03e4d157b78ad042b819c77b9b1d3c04d29e6ac49b9dae21cda
BLAKE2b-256 checksum
How to use checksums
73f38ed8b01d7c4b7b497b5701be4c88a7610df96e4acc509b64ac55faa39dee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page