A clean, customizable logging package with rich formatting, diagnostics, and rotating file output.
Project description
🪵 Chronilog
Chronilog is a clean, configurable, and developer-friendly logging package for Python. It provides rich terminal output, rotating file logging, diagnostics, and full environment-based customization — all in a zero-hassle API.
Designed for real-world projects that need stability, structure, and style in their logs.
🚀 Features
- ✅
ChroniLog(name)— powerful, configurable logger instance - 🎨 Rich console output with emoji support
- 📁 Rotating file logs (configurable via
.envor.toml) - ⚙️ Environment + TOML-based configuration layering
- 🧪 Built-in diagnostics system (
print_diagnostics()) - 🔄 Optional JSON logging
- 🧰 Developer-first: testable, extensible, and production-ready
📦 Installation
pip install -e .
Clone this repo and install it locally in editable mode during development.
🧠 Basic Usage
from chronilog import ChroniLog
log = ChroniLog("my_app")
log.info("🚀 App started")
log.warning("⚠️ Something might be wrong...")
log.error("❌ An error occurred!")
⚙️ Configuration Options
Chronilog supports config from 3 layers:
.env file
.chronilog.toml file
Built-in defaults
🔧 Example .env
CHRONILOG_LOG_PATH=logs/my_app.log
CHRONILOG_LOG_LEVEL=DEBUG
CHRONILOG_LOG_MAX_MB=5
CHRONILOG_LOG_BACKUP_COUNT=3
CHRONILOG_JSON=0
🧪 Diagnostic Mode
from chronilog.diagnostics import print_diagnostics
print_diagnostics()
You’ll get a Rich-powered terminal table showing logger status and any setup issues.
✨ Customizing ChroniLog
You can override behavior with optional arguments:
from chronilog import ChroniLog
from chronilog.core.formatter import PlainFormatter
log = ChroniLog(
name="myapp",
level=logging.INFO,
file_formatter=PlainFormatter(),
use_cache=False
)
🔎 Parameters
| Argument | Type | Description |
|---|---|---|
name |
str |
Logger name (typically __name__) |
level |
int (optional) |
Custom log level (logging.DEBUG, etc) |
console_formatter |
Formatter |
Optional override for console formatter |
file_formatter |
Formatter |
Optional override for file formatter |
use_cache |
bool |
Whether to reuse existing logger by name |
📁 Default Log Paths
Automatically chooses safe OS-specific defaults:
-
🪟 Windows →
%LOCALAPPDATA%/chronilog/logs/ -
🍎 macOS →
~/Library/Logs/chronilog/ -
🐧 Linux →
~/.local/share/chronilog/logs/
🧪 Example Project Structure
myapp/
├── main.py
├── .env
├── logs/
│ └── chronilog.log
└── requirements.txt
🧪 Example: test_app.py
from chronilog import ChroniLog
log = ChroniLog("test_app")
log.info("🚀 Startup")
log.debug("🔧 Debugging")
log.warning("⚠️ Warning issued")
log.error("❌ Error occurred")
log.critical("🔥 Critical failure")
🧪 Testing
pytest tests/
Or run the built-in usage script:
python examples/usage.py
📜 License
MIT License — free to use, modify, and contribute.
💡 Coming Soon
chronilog diagnostics CLI tool
JSON log viewer + filter
Async logging support
Release to PyPI (pip install chronilog)
🙌 Credits
Built with ❤️ by [Brandon McKinney]
Inspired by clean logging practices at scale.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 chronilog-0.1.0.tar.gz.
File metadata
- Download URL: chronilog-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76231ea0211b78dacd15b62e4ce4a8f01ee677e4e98e200d57a6ef6d26472ce4
|
|
| MD5 |
4b7163dcdab3ab9d0968a0006d4f0e21
|
|
| BLAKE2b-256 |
904c8963500391bf1c4c91a88e67bc62219671d0ebc87cc0cde55a023c292c5f
|
File details
Details for the file chronilog-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chronilog-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a582f0e90043a2e7060ea1926567ea65b547caf823249b23638cca07bf2b5c9
|
|
| MD5 |
a55bd1f4ec027417e9d7a09012e34396
|
|
| BLAKE2b-256 |
38f9398e559f0b747c341e2c6091a2d1918e6596f3e4d86459725fcebed493d1
|