dlogger by drawiks
Project description
📝 dlogger
dlogger — simple logger for personal projects
(─‿‿─)
____ __
/ __ \ / / ____ ____ _ ____ _ ___ _____
/ / / / / / / __ \ / __ `// __ `// _ \ / ___/
/ /_/ / / /___/ /_/ // /_/ // /_/ // __// /
/_____/ /_____/\____/ \__, / \__, / \___//_/
/____/ /____/
📦 installation
pip install dlogger-drawiks
📑 quick start
from dlogger import logger
logger.info("hello, world!")
logger.error("something went wrong")
with configuration:
from dlogger import logger
logger.configure(
level="INFO",
log_file="app.log",
rotation="10MB",
retention="7 days",
compression=True
)
logger.debug("this won't be shown")
logger.info("but this will")
🧩 features
- 🎨 colored output — different colors for different levels
- 📁 size-based rotation —
rotation="10MB" - ⏰ time-based rotation —
rotation="1 day" - 🗑️ auto cleanup —
retention="7 days" - 📦 compression —
compression=True - 🚫 no dependencies — stdlib only
📖 usage
log levels
logger.configure(level="INFO") # DEBUG, INFO, WARNING, ERROR, CRITICAL
size-based rotation
logger.configure(
log_file="app.log",
rotation="10MB" # or "500KB", "1GB"
)
once the file reaches 10MB → app.log.20260216_143022
time-based rotation
logger.configure(
log_file="app.log",
rotation="1 day" # or "12 hours", "1 week"
)
log retention
logger.configure(
log_file="app.log",
retention="7 days" # or "2 weeks", "1 month"
)
logs older than 7 days will be deleted automatically
compression
logger.configure(
log_file="app.log",
rotation="10MB",
compression=True # old logs → .gz
)
full configuration
logger.configure(
level="INFO", # minimum log level
log_file="logs/app.log", # path to log file
show_path=True, # show module:function:
rotation="10MB", # size-based rotation
retention="7 days", # keep logs for 7 days
compression=True # compress old logs
)
💡 examples
simple logging
from dlogger import logger
logger.info("server started on port 8000")
logger.warning("memory usage at 80%")
logger.error("failed to connect to database")
with file
from dlogger import logger
logger.configure(
level="DEBUG",
log_file="app.log"
)
logger.debug("starting request processing")
logger.info("request processed successfully")
for production
from dlogger import logger
logger.configure(
level="INFO",
log_file="logs/production.log",
rotation="50MB",
retention="30 days",
compression=True
)
logger.info("application started")
logger.error("critical error in payments module")
📝 log format
console:
2024-02-16 14:30:22 | INFO | app.services.groq:get_groq: - application started
file:
[2024-02-16 14:30:22] INFO | application started | app.services.groq:get_groq:
[2024-02-16 14:30:23] ERROR | connection failed | app.db.client:connect:
📜 license
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
dlogger_drawiks-0.2.0.tar.gz
(6.4 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 dlogger_drawiks-0.2.0.tar.gz.
File metadata
- Download URL: dlogger_drawiks-0.2.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e713ed5dc78c052e22a84d8a4b4b9dbb8fad575c7ff4d200ec41ab64d309fc0
|
|
| MD5 |
563d48d139eebd81025d1ce068b617e7
|
|
| BLAKE2b-256 |
66b054c641b6011fdf8745f62147ffef52555d83122fc8352004c635bc4daf5b
|
File details
Details for the file dlogger_drawiks-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dlogger_drawiks-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
703c4c68ab74898e5f7c70eecd37ac6f9839924b29057f897d434cdb16f22ebe
|
|
| MD5 |
908120db1c3a64db8a1c738881bc195f
|
|
| BLAKE2b-256 |
b373f3ea037517b36ced6f7744fb7287614222b15fd2780a20d006fd83c624d3
|