struct_log 0.1.0
struct_log: ^0.1.0 copied to clipboard
Structured logging for Dart with pluggable sinks, OpenTelemetry-compatible context (spanId/traceId), and zero Flutter dependency.
Changelog #
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 withspanId,traceId, andMap<String, Object> attributesfor telemetry correlation.LogSink— abstract interface withwrite/flush/closelifecycle.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 liveonRecordstream andonClearnotification. Ideal for debugging UIs and test assertions.ConsoleSink— platform-adaptive sink usingdart:developer(native) and browserconsoleAPI (web).StdoutSink— platform-adaptive sink usingdart:iostdout with optional ANSI color codes. No-op on web.