A logging utility for Python. Developed for personal use.
Project description
loggerric
loggerric is a lightweight Python utility library providing advanced logging, for CLI applications. It offers colorful, formatted output to make debugging, logging and tracking easier.
Features
- Logging: Structured logging with levels:
INFO,WARN,ERROR,DEBUG. - Pretty Printing: Pretty print variables like arrays and dictionaries.
- Progress Bars: Real-time CLI progress bars with ETA calculations.
- Prompts: Interactive user input with optional choices and defaults.
- Timers: Measure execution time of code snippets.
Installation
pip install loggerric
Usage
Logging
from loggerric import Log, LogLevel
Log.pretty_print({ 'name': 'John Doe' }, indent=4)
Log.info("This is an info message", "This is also a message", ...)
Log.warn("This is a warning", ...)
Log.error("This is an error", ..., quit_after_log=True)
Log.debug("This is a debug message", ...)
# Enable or disable specific logging levels
Log.disable(LogLevel.DEBUG, LogLevel.WARN, ...)
Log.enable(LogLevel.DEBUG, ...)
Progress Bar
from loggerric import ProgressBar
from time import sleep
end_val = 50
bar = ProgressBar(end_value=end_val, name='Downloading', bar_length=40)
for i in range(1, end_val + 1):
sleep(0.05)
bar.update(i)
Prompt
from loggerric import prompt
# Simple input
name = prompt("Enter your name")
# Input with options
choice = prompt("Choose a letter", options=['a', 'b', 'c'], default='b', loop_until_valid=True, case_sensitive=False)
Timer
from loggerric import Timer
from time import sleep
with Timer(name='Calculation Timer'):
sleep(1.5)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
loggerric-1.1.1.tar.gz
(7.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loggerric-1.1.1.tar.gz.
File metadata
- Download URL: loggerric-1.1.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31e9b65b8890e05c825f8d0690aa946d472ea87d1a8c2759719e6cd521f740f8
|
|
| MD5 |
518d79cedb93c9bbe36488275b741540
|
|
| BLAKE2b-256 |
bcbdc255bde440ce7a9145467149b69817f0b1b06b988c111d6110cf3bcd9032
|
File details
Details for the file loggerric-1.1.1-py3-none-any.whl.
File metadata
- Download URL: loggerric-1.1.1-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01263e1de090457b2e79e25f49e18f61ac1d317188d5c7de87bb2a4dae970634
|
|
| MD5 |
64d9db018ff63736d892f722e0b58cc6
|
|
| BLAKE2b-256 |
bc0010361ad614f65b2e9ec56bb6dbed48316293a0b26b659da1aa5208b0f625
|