cocomon

comon_logger

Composable logging docs for Dart and Flutter with core, Flutter UI, HTTP, file, sharing, and navigation integrations.

comon_logger docs

comon_logger is a logging ecosystem for Dart and Flutter built around one shared model:

  • named hierarchical loggers
  • typed metadata on every record
  • per-handler filters
  • pluggable handlers and formatters
  • optional integrations layered on top of the zero-dependency core

The ecosystem is split into focused packages so you can keep the core small and add UI, HTTP logging, file persistence, or sharing only where needed.

Package matrix

PackageUse it forWhen to add it
comon_loggerCore logger, filters, handlers, formattersAlways start here
comon_logger_otelExport comon_logger records into OpenTelemetry logs with trace correlationYou already use comon_otel and want logs in the same observability pipeline
comon_logger_flutterIn-app viewer and session historyYou want to inspect logs inside a Flutter app
comon_logger_dioDio interceptor and HTTP console formatterYou use Dio and want structured network logs
comon_logger_dio_flutterRich HTTP cards in the Flutter viewerYou already log Dio requests into HistoryLogHandler
comon_logger_fileRotating file persistenceYou need on-disk logs for backend or app diagnostics
comon_logger_navigation_flutterNavigatorObserver with structured route eventsYou want route transitions in the same logging pipeline
comon_logger_share_flutterShare/export action for the viewerYou need to export logs from a Flutter device
comon_logger_devtools_extensionDevTools panel supportYou want logs streamed into a custom DevTools tab

Typical setups

Console only

Use comon_logger with ConsoleLogHandler.

Flutter app diagnostics

Use comon_logger + comon_logger_flutter, then add HTTP, share, and navigation packages as needed.

Backend or CLI service

Use comon_logger + comon_logger_file for console plus rotating disk output.

Unified observability

Use comon_logger + comon_logger_otel when the project already emits traces or metrics through comon_otel and logs should go to the same backend with active trace correlation.

Full mobile debugging stack

Use:

  • comon_logger
  • comon_logger_flutter
  • comon_logger_dio
  • comon_logger_dio_flutter
  • comon_logger_navigation_flutter
  • comon_logger_share_flutter

Design rules

  1. Keep Logger.root as the aggregation point for app-wide handlers.
  2. Use typed tags like LogLayer and LogType instead of encoding everything into the message.
  3. Filter at the handler level so different outputs can keep different noise thresholds.
  4. Treat Flutter UI and DevTools integrations as optional consumers of the same structured records.
  1. Start with Getting started.
  2. Read Core to understand the data model and filter pipeline.
  3. Add OpenTelemetry if logs should leave the app as part of a broader observability pipeline.
  4. Add Flutter or Dio depending on your app shape.
  5. Add File logging, Navigation, and Sharing as focused extensions.

On this page