Skip to main content

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 .env or .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

chronilog-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chronilog-0.1.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file chronilog-0.1.1.tar.gz.

File metadata

  • Download URL: chronilog-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for chronilog-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dffbbb20e6d9c91530b39d11a82daef337d6bb6398d53c8da93684f49acf9dbe
MD5 74f15a9adc434e0d860c3cf0ad37ee3a
BLAKE2b-256 144b31252200daaab46fe4294f77b35f462d606a59511b21f82a9ef8ae0f5e49

See more details on using hashes here.

File details

Details for the file chronilog-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: chronilog-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for chronilog-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11dbcb555e30ab916cd95b7d9b85ea8c32bf322a85ab78594b36d36a752c39a6
MD5 c8264a9983db27310de9265f6bca173d
BLAKE2b-256 5d0ca62f3bec41f540b35c01a2fc0ad7e881c1c2942a0c94f21c9fa7fc286495

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page