opentelemetry_logging 0.7.0 copy "opentelemetry_logging: ^0.7.0" to clipboard
opentelemetry_logging: ^0.7.0 copied to clipboard

A simple library implementing sending logs to OpenTelemetry, supports gRPC and HTTP protocols.

OpenTelemetry Logging Dart #

Pub Version Coverage OpenSSF Scorecard

A Dart package for logging with OpenTelemetry, supporting gRPC backends and seamless integration with observability platforms.

Features #

  • Simple logging
  • OpenTelemetry protocol support (gRPC and HTTP)

Resource Attributes #

You can attach OpenTelemetry resource attributes to your logs.
These are used by observability backends (Grafana, Tempo, Loki, OTel Collector) to identify the service emitting the logs.

Common attributes include:

  • service.name
  • service.version
  • deployment.environment

Resource attributes support typed values (string, int, bool, arrays).

Getting Started #

Add the package to your pubspec.yaml:

dependencies:
  opentelemetry_logging: ^latest

Import and use in your Dart code:

import 'package:opentelemetry_logging/opentelemetry_logging_dart.dart';

// Create logger
final logger = OpenTelemetryLogger(
  backend: OpenTelemetryHttpBackend(
    endpoint: Uri.parse('http://localhost:4318/v1/logs'),
    resourceAttributes: {
      'service.name': 'example-app',
      'service.version': '1.0.0',
      'deployment.environment': 'dev',
      'build': 42,
      'isDebug': true,
    },
  ),
  batchSize: 10,
  flushInterval: const Duration(seconds: 5),
  traceId: '1234567890abcdef1234567890abcdef',
);

// Use logger
logger.debug('Hello!');

Contributing #

Contributions are welcome! Please open issues or pull requests on GitHub.

License #

This project is licensed under the MIT License.

0
likes
150
points
9.21k
downloads

Documentation

API reference

Publisher

verified publisherchimerapps.com

Weekly Downloads

A simple library implementing sending logs to OpenTelemetry, supports gRPC and HTTP protocols.

Repository (GitHub)
View/report issues

Topics

#logging #opentelemetry

License

MIT (license)

Dependencies

fixnum, grpc, http, protobuf

More

Packages that depend on opentelemetry_logging