Skip to main content

logsmith 2.0.0 copy "logsmith: ^2.0.0" to clipboard
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 defaultLogger and the top-level trace, debug, info, success, warning, error, and fatal functions.
  • Public user-assembled pipeline machinery: Handler, StreamPolicy, RecordAwareSink, FileSink, RotatingFileSink, AsyncHandler, closeSink, SinkErrorHandler, and reportSinkError.
  • The Emitter formatter facade and the v1 JsonRecordEncoder, LogfmtRecordEncoder, YamlRecordEncoder, TomlRecordEncoder, and MaceRecordEncoder pipeline formatter types.
  • LoggerKind and LoggerKinds as public record/wiring concepts.
  • Public terminal sink customization and stripping machinery: TerminalCapabilities, ColorPolicy, AnsiSink, stripAnsi, and stripAnsiStyling.
  • Rendering kind and zone identity from the public Record data model.

Replaced #

  • v1 concrete Logger.singleLine, Logger.multiline, and Logger.boxed pipeline construction with use-case loggers: TerminalLogger, MachineLogger, FileLogger, and SilentLogger.
  • v1 multiple-handler fan-out with CompositeLogger.
  • v1 AsyncHandler delivery with AsyncLogger, which wraps any v2 Logger directly.
  • v1 custom sinks and record-aware sink behavior with CallbackLogger or controlled inheritance from the v2 Logger base type.
  • v1 emitter/encoder formatting with advanced serializer types exposed only through package:logsmith/serialization.dart: JsonRecordSerializer, LogfmtRecordSerializer, TextRecordSerializer, YamlRecordSerializer, TomlRecordSerializer, and MaceRecordSerializer.
  • v1 sink error hooks with destination-specific FileErrorHandler, AsyncErrorHandler, and CallbackErrorHandler typedefs.
  • v1 soft rotating-file-sink behavior with frame-aware FileRotation.size, .time, and .sizeAndTime policies using strict whole-event UTF-8 byte caps.

Added #

  • A method-first controlled-inheritance Logger interface with package-owned level extension methods and immutable withAttrs derivation.
  • TerminalLogger rendering 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.
  • MachineLogger JSON and logfmt output using the stable-additive structured schema with explicit levelValue.
  • FileLogger JSON, 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, and SilentLogger adapters.
  • FileRotation, FileTimeRotationMode, FileTextLayout, and LogfmtNewlineMode configuration types.
  • Independent basic and advanced imports: package:logsmith/logsmith.dart for logging and package:logsmith/serialization.dart for 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.
0
likes
160
points
151
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A declarative structured-logging library — typed attrs, themed output, six formats (text, JSON, YAML, TOML, Mace, logfmt), and categorical stdout/stderr routing.

Repository (GitHub)
View/report issues

Topics

#logging #structured-logging #terminal #ansi #cli

License

BSD-3-Clause (license)

Dependencies

toml

More

Packages that depend on logsmith