Logging Manager
Provides simple APIs for logging & managing logs. Uses the logger from pub.dev:logging.
If using flutter, import pub.dev:logging_manager_flutter instead.
Features
LoggingTreeis attached as a listener to logs sent from logger by theLoggingManager. Implementations are: PrintingColoredLogsTree, PrintingLogsTree, FormattedOutputLogsTree.LoggingManagercan be used to create a logger, listen to logs, changeLoggingTrees.
Getting started
Start by importing this package in your project using
For Dart
dart pub add logging_manager
For Flutter
flutter pub add logging_manager
With Pub
pub add logging_manager
Usage
- Import this package in file.
import 'package:logging_manager/logging_manager.dart';
- Create a LoggingManager. Note: A LoggingTree is responsible for doing something with logs. If none provided, nothing will happen.
final logginManager = LoggingManager(
tree: PrintingColoredLogsTree(),
);
- Get
package:logging's logger. TheLoggingpackage's logger factory constructor returns a singleton instance from a matchingname. The logger used in the above package also had''as its name.
final logger = Logger('');
- Use it to log anything.
logger.info('Hello World');
Additional information
- To catch errors from the
Zone, you can userunZoneGuardedWithLogging. - To catch errors that happen outside of the main Isolate's context, install an error listener on the current Isolate with
listenErrorsInIsolate(Isolate.current); - Please check the example for more usage information.
- For more information about using the logger, check pub.dev:logging.
Libraries
- logging
- This library providers Logging, a wrapper around Logger which allows you to create child loggers by calling
()on the instance. This is useful for creating loggers with different namespaces. - logging_manager