logcat_monitor

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

logcat monitor

logcat_monitor #
Flutter plugin to monitor the stream of system messages, stack traces etc using logcat command-line tool.
NOTE: This plugin fetches logs only on Android Devices presently.
how to use #

Create a function to consume the logcat messages

void _mylistenStream(dynamic value) {
if (value is String) {
_logBuffer.writeln(value);
}
}
copied to clipboard

Register your function as a listener to get logs then use it in anyway within your app.

LogcatMonitor.addListen(_mylistenStream);
copied to clipboard

Start the logcat monitor passing the filter parameters as defined in logcat tool.

await LogcatMonitor.startMonitor("*.*");
copied to clipboard
Installation #
Need permission in AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_LOGS" />
copied to clipboard
https://pub.dev/packages/logcat_monitor/install
example #
Follows a screenshot of example code in example folder.
Here we use a StringBuffer to store the messages and display them in the log screen.



under the hood #
The LogcatMonitorPlugin 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 logcat -h:
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.
copied to clipboard
Examples:

*.* show ALL tags and priorities.
flutter,LogcatMonPlugin,S:* show flutter and LogcatMonPlugin and suppresses all others.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.