Skip to main content

Installation

Add structured_logger as a dependency (Dart-first):

dart pub add structured_logger

Or for a Flutter app:

flutter pub add structured_logger

Add to pubspec.yaml (or use the command above):

dependencies:
structured_logger: ^1.0.2

For Dio HTTP logging, also add the interceptor:

dependencies:
structured_logger: ^1.0.2
structured_logger_dio_interceptor: ^1.2.0

Then fetch dependencies:

dart pub get
# or
flutter pub get

Import

Import the package in the Dart file where you use the logger:

import 'package:structured_logger/structured_logger.dart';

Transitive dependency

The package declares http as a dependency (used by SinkSeq). You do not need to add it manually unless you inject a custom http.Client in tests.

Included example

The repository includes a sample app in example/. To run it (pure Dart CLI):

cd example
dart run lib/main.dart

The example registers SimpleLineSink and DefaultSink and emits a demo log. (Flutter apps continue to consume the package normally via flutter pub add.)