logging_appenders 2.0.0+1 copy "logging_appenders: ^2.0.0+1" to clipboard
logging_appenders: ^2.0.0+1 copied to clipboard

Logging appenders for the dart logging package for print, file and remote (logz, loki, graylog (gelf)).

example/lib/main.dart

import 'dart:isolate';

import 'package:logging/logging.dart';
import 'package:logging_appenders/logging_appenders.dart';

final _logger = Logger('example');

void main() {
  Logger.root.level = Level.ALL;
  final appender = PrintAppender.setupLogging(stderrLevel: Level.SEVERE);
  //  Equal to:
  //  final appender = PrintAppender(formatter: const ColorFormatter())
  //    ..attachToLogger(Logger.root);
  _logger.fine('Lorem ipsum');
  _logger.info('An important info message');
  _logger.severe('This is bad.');
  _logger.shout('This is just impolite');

  Isolate.run(_isolateWork, debugName: 'Child Isolate');
  Isolate.run(_isolateWork);

  // optionally dispose of the appender.
  appender.dispose();
}

void _isolateWork() {
  // Child isolates need to setup logging again.
  PrintAppender.setupLogging();
  _logger.fine('Hello world from child!');
}
42
likes
160
points
21.7k
downloads
screenshot

Documentation

API reference

Publisher

verified publishercodeux.design

Weekly Downloads

Logging appenders for the dart logging package for print, file and remote (logz, loki, graylog (gelf)).

Repository (GitHub)
View/report issues

Topics

#logging #error #console

License

MIT (license)

Dependencies

clock, http, intl, logging, meta

More

Packages that depend on logging_appenders