Coder Social home page Coder Social logo

lucribas / logcat_monitor Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 3.0 632 KB

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

Home Page: https://pub.dev/packages/logcat_monitor

License: Apache License 2.0

Java 39.51% Dart 60.49%
android-plugin dart flutter logcat streaming

logcat_monitor's Introduction

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

  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.
    LogcatMonitor.addListen(_mylistenStream);
  1. Start the logcat monitor passing the filter parameters as defined in logcat tool.
    await LogcatMonitor.startMonitor("*.*");

Installation

Need permission in AndroidManifest.xml:

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

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.

Examples:

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

logcat_monitor's People

Contributors

lucribas avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.