Logging Manager for Flutter Projects

Pub:logging

Provides simple APIs for logging & managing logs. Logging manager with flutter support.

Features

  • Provides class FlutterLoggingManager which extends on the LoggingManager for flutter projects.
  • This class has onFlutterError method which can be capture flutter error.
  • listenErrorsWithCurrentIsolate can be used to listen errors in the current isolate.
  • runFlutterInZoneGuardedWithLogging can be used to log errors caught in the zone for flutter.
FlutterError.onError = loggingManager.onFlutterError;

Get Started - Dependency setup

Either add dependency in pubspec.yaml file

    logging_manager_flutter: ^2.0.0

Or add dependency with

    flutter pub add logging_manager_flutter

Usage

  1. Import this package in file.
import 'package:logging_manager_flutter/logging_manager_flutter.dart';
  1. Create a LoggingManager, a class which is exported from package:logging_manager_flutter. Note: A LoggingTree is responsible for doing something with logs. If none provided, nothing will happen.
final loggingManager = LoggingManager(
   logger: Logger('MyApp'),
   tree: PrintingColoredLogsTree(),
);
  1. Optionally add flutter logging manager to record flutter errors.
FlutterError.onError = loggingManager.onFlutterError;
  1. Create package:logging's logger which is managed by the above manager.
final componentLogger = Logger('MyApp.componentName');
  1. Use logger to log anything.
componentLogger.info('Hello World');

Additional Information

For more usage see Logging Manager package.

Libraries

logging_manager_flutter