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.
PyPi Statistics:
Features
- Logging: Structured logging with levels:
INFO,WARN,ERROR,DEBUGwith highlight. - Log2File: Fully automatic logging to file, with various options for customization.
- Debug Decorator: Lightly debug and semi-benchmark any function using the decorator.
- Pretty Printing: Pretty print variables like arrays and dictionaries.
- Tables: Log datasets via CLI colored tables with headers and autosizing.
- 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.
- Timestamps: Optional, can be used independently, and support rolling differences.
Installation
pip install loggerric
Usage
Log To File
from loggerric import LogToFile, LogToFileLevel
LogToFile.set_dump_location('C:/Users/MyCoolUsername/Desktop', 'important_log') # Don't include the extension
# Control file logging from anywhere
LogToFile.start_logging()
LogToFile.stop_logging()
# Decide what should be logged to file
LogToFile.enable(LogToFileLevel.INFO, ...)
LogToFile.disable(LogToFileLevel.TIMER, ...)
Logging
from loggerric import Log, LogLevel
# Pretty print dictionaries or arrays, including subdicts
Log.pretty_print({ 'name': 'John Doe' }, indent=4)
# Print out a formatted table
headers = ['Item', 'Stock', 'Price']
rows = [('Cola', '25', '$2.99'), ('GPU', '3', '$995.00'), ('Feather', '2,500', '$0.29')]
Log.table(headers, rows, table_name='Store Items')
Log.info("This is an info message", "This is also a message", ..., highlight=['This', 'message'])
Log.warn("This is a warning", ..., highlight='warning')
Log.error("This is an error", ..., quit_after_log=True, highlight='error')
Log.debug("This is a debug message", ..., highlight='debug')
# Enable or disable specific logging levels
Log.disable(LogLevel.DEBUG, LogLevel.WARN, ...)
Log.enable(LogLevel.DEBUG, ...)
# Debug function using decorator
@Log.debugdec(log_return_value=True, log_args=True)
def my_func(a:int, b:int):
return a + b
my_function(6, 7)
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)
Timestamp
from loggerric import Timestamp, Log
Timestamp.set_format('{HH}:{MM}:{SS}.{MS} T+{dm}ms')
Log.info(Timestamp.get())
Metadata
Release files for loggerric 1.5.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loggerric-1.5.11.tar.gz | 15.5 kB | Without provenance | Details for loggerric-1.5.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loggerric-1.5.11-py3-none-any.whl | Python 3 | none | any | Details for loggerric-1.5.11-py3-none-any.whl |
Total release size: 32.8 kB
Release files / loggerric-1.5.11.tar.gz
| Download URL | loggerric-1.5.11.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f255693d6e6c36a98c698f65ffee3b1a775ed925a032f1c1a9ddda099fb8cd54
|
|
BLAKE2b-256 checksum How to use checksums |
7a87eb7b977f0dfac3578e3fec4b35a1b9b263f94c7d9f7310ba0694d23a4f6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / loggerric-1.5.11-py3-none-any.whl
| Download URL | loggerric-1.5.11-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d47a66348c68ecaf44901c4e0f17ec51f7d060cc2b08fa4c89fcc4181fd67534
|
|
BLAKE2b-256 checksum How to use checksums |
ba3702622032ed6be8555f3d61e000ca81acfa53e6cddcd5a0134f6d1c054110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for loggerric 1.5.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.