Skip to main content

structured_log_logging 0.1.0-dev.3 copy "structured_log_logging: ^0.1.0-dev.3" to clipboard
structured_log_logging: ^0.1.0-dev.3 copied to clipboard

StructuredLogLoggingBridge — routes every package:logging record into structured_log, so the logs of libraries that write through package:logging reach the same sinks, viewer and server as your own.

example/main.dart

import 'package:logging/logging.dart';
import 'package:structured_log/structured_log.dart';
import 'package:structured_log_logging/structured_log_logging.dart';

void main() {
  StructlogConfiguration.configure(output: jsonLineOutput);

  // package:logging's own gate: records below it are never created, so they
  // never reach the bridge. The bridge leaves it to you.
  Logger.root.level = Level.ALL;
  final bridge = StructuredLogLoggingBridge()..attach();

  // What a library writing through package:logging does.
  final db = Logger('db');
  db.config('pool size 4');
  db.fine('query took 3 ms');
  try {
    throw StateError('connection closed');
  } catch (error, stackTrace) {
    db.severe('query failed', error, stackTrace);
  }

  // Your own entries go to the same outputs.
  getLogger('app').info('ready');

  bridge.detach();
}
0
likes
150
points
196
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

StructuredLogLoggingBridge — routes every package:logging record into structured_log, so the logs of libraries that write through package:logging reach the same sinks, viewer and server as your own.

Homepage
Repository (GitHub)
View/report issues

Topics

#logging #structured-logging #debugging

License

MIT (license)

Dependencies

logging, structured_log

More

Packages that depend on structured_log_logging