cocomon

Core

Understand the logger hierarchy, record model, tags, filters, handlers, and formatter flow in comon_logger.

Core

The comon_logger core is intentionally small. It gives you one structured record model and one propagation model that all other packages build on.

Main building blocks

PieceResponsibility
LoggerPublish records and manage named hierarchy
LogRecordImmutable structured event
LogFilterDecide whether a handler should process a record
LogHandlerSend accepted records to some output
LogFormatterConvert records to text for a handler

Record flow

  1. Application code calls log.info(...) or another level method.
  2. A LogRecord is created with message, time, metadata, and optional error data.
  3. The record propagates through the logger hierarchy.
  4. Each attached handler applies its own filter.
  5. Accepted records are handled directly or formatted first.

Default mental model

  • one Logger.root
  • many named child loggers
  • root handlers for global sinks
  • optional child-specific handlers for focused outputs

On this page