Loguru-based logger utilities with file and tracker handlers
Project description
new_logger
A small utility package that wraps Loguru with two pre-configured loggers and file handlers:
logger: console-bound logger (INFO+ to stderr by default) with optional rotating file handlers per level.tracker_logger: silent console, writes tracker lines to a dedicated rotating file.
Installation
Build the wheel and install it into your environment:
python -m pip install --upgrade build wheel
python -m build
python -m pip install dist/new_logger-0.1.0-py3-none-any.whl
Usage
from new_logger import (
logger,
tracker_logger,
add_file_handler_to_logger,
add_track_handler,
)
# Add rotating file handlers (daily rotation, 7 days retention)
add_file_handler_to_logger(name="app", dir_path="./logs", level="DEBUG")
add_file_handler_to_logger(name="app", dir_path="./logs", level="ERROR")
# Add tracker handler (plain message lines)
add_track_handler(dir_path="./logs")
logger.info("Hello from new_logger")
tracker_logger.info("user_id=123 action=click item_id=42")
Requirements
- Python >= 3.8
loguru>=0.7
Notes
- Console output filters to
INFOand above. - File handlers rotate daily and keep 7 days.
tracker_loggerwrites only to its tracker sink, not console.
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
new_logger-0.1.0.tar.gz
(2.3 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 new_logger-0.1.0.tar.gz.
File metadata
- Download URL: new_logger-0.1.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8053f125a7edb4612400438c96c858ea28dea523482b6534699cfdde5c91bd86
|
|
| MD5 |
a09db88f834a0435d591910b9481ea17
|
|
| BLAKE2b-256 |
557bb868e770d5c454bea4a1b26169107ba66be165f2f92b767c1b57fd3c4d3b
|
File details
Details for the file new_logger-0.1.0-py3-none-any.whl.
File metadata
- Download URL: new_logger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
725f6e3e2c40de9a58d2fbd356b3af486046cb5931160194f67a40a90c9c8539
|
|
| MD5 |
df427111cb321808769b7b50ddfafad7
|
|
| BLAKE2b-256 |
d6ce45c412290b3dca4ad78cff0daab685c7536d45a2451594d4a43c13a073b7
|