Skip to main content
Chromologger allows any number of Logger instances to be active at the same time, each writing independently to its own file. This lets you separate concerns cleanly: access events, application errors, and performance metrics each live in their own log file and can be inspected, archived, or rotated individually.

Creating multiple loggers

multiple_loggers.py
Each constructor call opens a separate file handle in append mode, so existing log entries are preserved across restarts.

Using them independently

Route each event to the logger that matches its purpose:
Calls to different loggers are completely independent — writing to access_logger has no effect on error_logger or perf_logger.

Closing all loggers

Collect your loggers in a list so you can close them all in a single loop, typically inside a finally block:
close() returns True for each logger that had a valid file open and False otherwise, so you can check the return values if you need to confirm cleanup.

Web application example

The pattern below shows how multiple loggers integrate naturally into an application class:
web_app.py
Each Logger opens its file in append mode. Concurrent writes from multiple threads to the same file are not guaranteed to be safe — file writes may interleave and produce corrupted log lines. Use a separate log file per Logger instance (as shown above) rather than pointing multiple loggers at the same path.