log_trail_flutter 0.1.1
log_trail_flutter: ^0.1.1 copied to clipboard
Flutter integration for log_trail: error hooks, a Flutter-aware console sink, a navigator observer and an in-app log viewer.
Flutter integration for
log_trail.
recordFlutterError: an extension on anyLogger(the root or a module's child logger) that records Flutter errors (FlutterErrorDetails):FlutterError.onError = logger.recordFlutterError. They become ordinary entries whoseLogError.reportcarries the original details, so every sink and sink wrapper receives them; Flutter-aware sinks read the details from there.recordPlatformErrorfitsPlatformDispatcher.instance.onError, which expects a handler returningbool.flutterConsoleSink(): the console sink fromlog_trailpreset to print throughdebugPrintinFlutterConsoleFormat, which renders Flutter errors with the fullFlutterErrorDetailsdiagnostics, in the same shape asFlutterError.dumpErrorToConsole, without ANSI colors by default:debugPrintoutput reaches the IDE throughos_log/syslog on iOS, which turn the escape codes into text. The format is aLogEntryFormatand can be used with anyConsoleSinkor replaced.LoggingNavigatorObserver: aNavigatorObserverthat logs route changes. It depends only onpackage:flutter/widgets.dart, not on Material.LogViewerPage: the in-app log viewer on top of aLogReader(anyLogStore) (package:log_trail_flutter/widgets.dart, which also re-exportspackage:log_trail/storage.dart). Its texts are English by default and can be translated withLogViewerStrings.
The example app wires all of this together: the root logger
created first, error hooks, the navigator observer, a few produced entries
and the viewer with export to the clipboard (flutter run in example/).
See the log_trail README
for the motivation and the overall design.