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.
Libraries
- isolates
- Logging from background isolates into the main isolate's root logger,
including engine-started isolates (FCM, WorkManager): an on-disk spool
(
LogSpool,LogSpoolSink,LogSpoolReceiver) as the source of truth, plus a notification port registered by name (registerIsolateLogPort,lookupIsolateLogPort) so the main isolate picks entries up now rather than at next startup. Separate fromlog_trail_flutter.dartbecausedart:isolateanddart:ioare unavailable on web. - log_trail_flutter
- widgets
- The log page and its parts. Separate from
log_trail_flutter.dartso that code without screens does not depend on Material.