logsmith 2.0.0
logsmith: ^2.0.0 copied to clipboard
A declarative structured-logging library — typed attrs, themed output, six formats (text, JSON, YAML, TOML, Mace, logfmt), and categorical stdout/stderr routing.
2.0.0 — v2 use-case logger API #
This is a clean major-version break from the v1 pipeline API. See docs/migration-v1-to-v2.md for task-oriented migration examples and the exhaustive removed-export inventory.
Removed #
- Package-owned mutable
defaultLoggerand the top-leveltrace,debug,info,success,warning,error, andfatalfunctions. - Public user-assembled pipeline machinery:
Handler,StreamPolicy,RecordAwareSink,FileSink,RotatingFileSink,AsyncHandler,closeSink,SinkErrorHandler, andreportSinkError. - The
Emitterformatter facade and the v1JsonRecordEncoder,LogfmtRecordEncoder,YamlRecordEncoder,TomlRecordEncoder, andMaceRecordEncoderpipeline formatter types. LoggerKindandLoggerKindsas public record/wiring concepts.- Public terminal sink customization and stripping machinery:
TerminalCapabilities,ColorPolicy,AnsiSink,stripAnsi, andstripAnsiStyling. - Rendering kind and zone identity from the public
Recorddata model.
Replaced #
- v1 concrete
Logger.singleLine,Logger.multiline, andLogger.boxedpipeline construction with use-case loggers:TerminalLogger,MachineLogger,FileLogger, andSilentLogger. - v1 multiple-handler fan-out with
CompositeLogger. - v1
AsyncHandlerdelivery withAsyncLogger, which wraps any v2Loggerdirectly. - v1 custom sinks and record-aware sink behavior with
CallbackLoggeror controlled inheritance from the v2Loggerbase type. - v1 emitter/encoder formatting with advanced serializer types exposed only through
package:logsmith/serialization.dart:JsonRecordSerializer,LogfmtRecordSerializer,TextRecordSerializer,YamlRecordSerializer,TomlRecordSerializer, andMaceRecordSerializer. - v1 sink error hooks with destination-specific
FileErrorHandler,AsyncErrorHandler, andCallbackErrorHandlertypedefs. - v1 soft rotating-file-sink behavior with frame-aware
FileRotation.size,.time, and.sizeAndTimepolicies using strict whole-event UTF-8 byte caps.
Added #
- A method-first controlled-inheritance
Loggerinterface with package-owned level extension methods and immutablewithAttrsderivation. TerminalLoggerrendering shapes, passive theme selection by default with opt-in adaptive/static modes, automatic/forced/disabled color modes, stderr thresholds, width controls, and opt-in caller/isolate metadata.MachineLoggerJSON and logfmt output using the stable-additive structured schema with explicitlevelValue.FileLoggerJSON, text, logfmt, YAML, TOML, and Mace constructors with complete event framing, eager lifecycle, explicit flush/close operations, error reporting, and size/time rotation.CompositeLogger,AsyncLogger,CallbackLogger, andSilentLoggeradapters.FileRotation,FileTimeRotationMode,FileTextLayout, andLogfmtNewlineModeconfiguration types.- Independent basic and advanced imports:
package:logsmith/logsmith.dartfor logging andpackage:logsmith/serialization.dartfor record-frame serialization utilities. - User documentation for terminal, machine, file, composition, asynchronous, callback, silent, and custom logger behavior, plus compile-checked migration examples.
Compatibility #
- The v2 machine schema is stable-additive: consumers should tolerate newly added optional fields while existing field meanings remain stable.
- The primary v2 public API follows semantic versioning from its first stable v2 release.
- The v1 pipeline API is not retained as a parallel compatibility surface; migration is explicit and documented.
1.0.0 #
Initial stable release.
- Immutable structured records with nested attrs, persistent logger attrs, zone attrs, caller capture, and sentinel-based record copying.
- Single-line, multiline, and boxed loggers with level-based stdout/stderr routing.
- Six emitters: terminal text, JSON, YAML, TOML, Mace, and logfmt.
- Fifty bundled terminal themes with dark/light pairs, style inheritance, color-depth quantization, OSC-8 hyperlinks, and OSC-11 adaptive terminal-background selection.
- Terminal policy detection for
NO_COLOR, force-color variables, terminal capabilities, pseudo-terminals, and machine consumers. - File and rotating-file sinks, record-aware flushing, ANSI-stripping sinks, and bounded asynchronous delivery.
- Opt-in isolate identity and terminal-cell-aware scalar truncation for human-readable output.