Skip to main content

structured_logger

structured_logger is a Flutter package for structured logging. Instead of plain strings, you emit events with a level, message template, and properties — and route each event to one or more pluggable sinks.

Why structured logging?

Structured logs make search, filtering, and correlation easier in production:

  • Templates with placeholders ({userId}, {duration}) keep messages readable while data stays queryable.
  • Levels (info, warning, error, …) help filter noise.
  • Sinks decouple emission from destination: console, dart:developer, Seq, or any backend you implement.

Key features

FeatureDescription
StructureLoggerCentral logger that fans out events to all registered sinks
LogSinkInterface for output destinations
SimpleLineSinkHuman-readable terminal line with placeholder interpolation
DefaultSinkOutput to the Dart developer log (dart:developer)
SinkSeqCLEF delivery to Seq servers
LogModelEvent model with CLEF-compatible fields (@t, @mt, @l)

Requirements

  • Dart SDK >=3.1.5 <4.0.0
  • Flutter >=1.17.0

Next steps