flutter_logcat_monitor 1.0.2 copy "flutter_logcat_monitor: ^1.0.2" to clipboard
flutter_logcat_monitor: ^1.0.2 copied to clipboard

PlatformAndroid

Flutter plugin to monitor the stream of system messages, stack traces etc using logcat command-line tool.

flutter_logcat_monitor #

Flutter plugin to monitor the stream of system messages, stack traces etc using logcat command-line tool.

NOTE: This plugin fetches logcat logs only on Android Devices.

how to use #

  1. Create a function to consume the logcat messages
  void _mylistenStream(dynamic value) {
    if (value is String) {
      _logBuffer.writeln(value);
    }
  }
  1. Register your function as a listener to get logs then use it in anyway within your app.
    FlutterLogcatMonitor.addListen(_mylistenStream);
  1. Start the logcat monitor passing the filter parameters as defined in logcat tool.
    await FlutterLogcatMonitor.startMonitor("*.*");

Installation #

Need permission in AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_LOGS" />

https://pub.dev/packages/flutter_logcat_monitor/install

example #

See the example code in example folder.

Here we use a StringBuffer to store the messages and display them on a log screen.

under the hood #

The FlutterLogcatMonitorPlugin runs event/method channel handlers in UI-thread and the logcat process monitor in a background thread as recomended by Google to not block the UI interface.

logcat filter options #

from the Android Developers logcat documentation:

filterspecs are a series of
  <tag>[:priority]

where <tag> is a log component tag (or * for all) and priority is:
  V    Verbose (default for <tag>)
  D    Debug (default for '*')
  I    Info
  W    Warn
  E    Error
  F    Fatal
  S    Silent (suppress all output)

'*' by itself means '*:D' and <tag> by itself means <tag>:V.
If no '*' filterspec or -s on command line, all filter defaults to '*:V'.
eg: '*:S <tag>' prints only <tag>, '<tag>:S' suppresses all <tag> log messages.

Examples:

  • *.* show ALL tags and priorities.
  • flutter,FlutterLogcatMonitorPlugin,S:* show flutter and FlutterLogcatMonitorPlugin and suppresses all others.
5
likes
160
pub points
43%
popularity

Publisher

unverified uploader

Flutter plugin to monitor the stream of system messages, stack traces etc using logcat command-line tool.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on flutter_logcat_monitor