otel_logging 0.1.0-beta.1 copy "otel_logging: ^0.1.0-beta.1" to clipboard
otel_logging: ^0.1.0-beta.1 copied to clipboard

Bridge `package:logging` records into the OpenTelemetry logs SDK so trace_id / span_id correlation lights up automatically for any Dart app using the Dart team's standard logging package.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

0.1.0-beta.1 - 2026-05-13 #

Added #

  • PackageLoggingBridge.install() / uninstall() — subscribes to package:logging's Logger.root.onRecord and emits OTel log records via the active LoggerProvider. Each Logger(name) becomes its own OTel instrumentation scope; severity is mapped to OTel Severity using the same boundaries as the SDK's existing dart:developer bridge.
  • error / stackTrace on a record become exception.type / exception.message / exception.stacktrace attributes.
  • Bridge holds a single StreamSubscription and cancels it on uninstall(), so the isolate exits cleanly after main() (related to issue #33 in the SDK repo).
  • Trace-log correlation: the bridge re-enters the caller's Zone (captured by package:logging on LogRecord.zone) before calling Logger.emit, so Context.current resolves to the user's active span instead of the install-zone's context. Without this, records emitted inside startActiveSpanAsync reached Loki without a trace_id / span_id, breaking the Grafana log→trace pivot. Pinned down by test/integration/lgtm_loki_test.dart.
1
likes
150
points
34
downloads

Documentation

API reference

Publisher

verified publisherdartastic.io

Weekly Downloads

Bridge `package:logging` records into the OpenTelemetry logs SDK so trace_id / span_id correlation lights up automatically for any Dart app using the Dart team's standard logging package.

License

Apache-2.0 (license)

Dependencies

dartastic_opentelemetry, dartastic_opentelemetry_api, logging

More

Packages that depend on otel_logging