Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Dev2Forge/chromologger/llms.txt

Use this file to discover all available pages before exploring further.

Chromologger is a lightweight Python library that makes adding production-quality logging to your application a one-liner. Drop in a Logger, call log() or log_e(), and every event lands in a structured file with microsecond timestamps — no configuration files, no boilerplate.

Installation

Install via pip and add Chromologger to your project in seconds.

Quickstart

Write your first log entry and capture your first exception in under five minutes.

Guides

Explore patterns for basic logging, exception handling, multiple loggers, and log organization.

API Reference

Full reference for the Logger class, FileManager utilities, and the Dates helper.

Why Chromologger?

Chromologger wraps Python’s file I/O into a clean, three-method API — log(), log_e(), and close(). Every record is written in a consistent [LEVEL][TIMESTAMP] - message format. When an exception is logged, the entry automatically includes the exception type, source file, line number, and message, so you spend less time reproducing bugs and more time fixing them.
1

Install the package

pip install chromologger
2

Create a Logger

from chromologger import Logger

logger = Logger()          # creates log.log beside your script
# or
logger = Logger('./logs/app.log')   # custom path
3

Log events and exceptions

logger.log('Application started')

try:
    result = 10 / 0
except Exception as e:
    logger.log_e(e)
4

Close when finished

logger.close()

Key features

Microsecond timestamps

Every log entry carries a YYYY-MM-DD HH:MM:SS.microseconds timestamp for precise event ordering.

Exception traceback capture

log_e() automatically extracts exception type, source file, and line number — no manual formatting needed.

Colorized console output

Informational and error messages appear in color in your terminal via the bundled chromolog dependency.

Zero-config defaults

Logger() with no arguments creates log.log in the same directory as your calling script.

Relative & absolute paths

Pass any path — relative or absolute — and Chromologger resolves it correctly using pathlib.

Append-mode writes

Log files are always opened in append mode, so no data is ever silently overwritten.

Build docs developers (and LLMs) love