Logging Manager for Flutter Projects
Provides simple APIs for logging & managing logs. Logging manager with flutter support.
Features
- Provides class
FlutterLoggingManager
which extends on theLoggingManager
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
- Import this package in file.
import 'package:logging_manager_flutter/logging_manager_flutter.dart';
- 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(),
);
- Optionally add flutter logging manager to record flutter errors.
FlutterError.onError = loggingManager.onFlutterError;
- Create
package:logging
's logger which is managed by the above manager.
final componentLogger = Logger('MyApp.componentName');
- Use logger to log anything.
componentLogger.info('Hello World');
Additional Information
For more usage see Logging Manager package.