struct_log 0.3.0 copy "struct_log: ^0.3.0" to clipboard
struct_log: ^0.3.0 copied to clipboard

Structured logging for Dart with pluggable sinks, OpenTelemetry-compatible context (spanId/traceId), and zero Flutter dependency.

Changelog #

0.3.0 #

  • Nullable attribute valuesLogRecord.attributes widened from Map<String, Object> to Map<String, Object?>. Logger method signatures updated to Map<String, Object?>?. Allows callers to distinguish "field present but null" from "field absent" — important for structured logging of optional fields (e.g., {'userId': null}). Fixes dart_monty#216.

0.2.0 #

  • LogManager.scoped() — named constructor that creates an independent LogManager instance with its own sink list and minimum level. Enables test isolation without mutating the global singleton. Fixes dart_monty#194.
  • final class LogManager — prevents subclassing. The public scoped() constructor would have allowed extends LogManager; final restores the original sealed-by-private-constructor intent.

0.1.0 #

  • Initial release of struct_log.
  • LogLevel — six-level severity enum (trace, debug, info, warning, error, fatal) with OTel-standard names and numeric values.
  • LogRecord — immutable structured log record with spanId, traceId, and Map<String, Object> attributes for telemetry correlation.
  • LogSink — abstract interface with write/flush/close lifecycle.
  • LogManager — singleton sink manager with fan-out, level filtering, and fault isolation (failing sinks do not crash the app).
  • Logger + LoggerFactory — named logger facade with level methods.
  • MemorySink — O(1) circular buffer with live onRecord stream and onClear notification. Ideal for debugging UIs and test assertions.
  • ConsoleSink — platform-adaptive sink using dart:developer (native) and browser console API (web).
  • StdoutSink — platform-adaptive sink using dart:io stdout with optional ANSI color codes. No-op on web.
0
likes
150
points
984
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Structured logging for Dart with pluggable sinks, OpenTelemetry-compatible context (spanId/traceId), and zero Flutter dependency.

Repository (GitHub)
View/report issues

Topics

#logging #structured-logging #observability

License

MIT (license)

Dependencies

meta

More

Packages that depend on struct_log