Giter Site home page Giter Site logo

carlonluca / logcat-colorize Goto Github PK

View Code? Open in Web Editor NEW
41.0 2.0 11.0 847 KB

Command that takes adb logcat from stdin and produces formatted colorized to stdout, written in C++.

License: Apache License 2.0

Makefile 4.90% Shell 15.54% C++ 67.58% Dockerfile 8.41% Tcl 3.58%
logcat adb android logging

logcat-colorize's Introduction

logcat-colorize

A simple program that colorizes Android Debug Bridge (adb)'s logcat output on a terminal window.

Notes:

  • supports output formats: brief, tag, process, time or threadtime (see more about this in the official docs);
  • works on Linux and Mac OS;

image

Installation

Snap

You can install logcat-colorize from Snappy: https://snapcraft.io/logcat-colorize.

sudo snap install logcat-colorize

Macports

You can install logcat-colorize from macports: https://github.com/macports/macports-ports/blob/master/devel/logcat-colorize/Portfile

sudo port install logcat-colorize

AUR

For those running on arch, there is also a package here: https://aur.archlinux.org/packages/logcat-colorize/

sudo pamac install logcat-colorize

DIY (from sources)

This depends on:

  • libboost-regex
  • libboost-program-options

If you are on Debian/Ubuntu:

    $ sudo apt-get install -y build-essential libboost-regex-dev libboost-program-options-dev

If you are on Mac OS X (using macports with libs installed in /opt/local):

    $ sudo port install boost

Compile and install:

    # download (or clone) the source
    $ make
    $ sudo make install

Usage

    # Help and version info:
    $ logcat-colorize
    
    # Simplest usage:
    $ adb logcat | logcat-colorize
    
    # Using specific device, with time details, and filtering:
    $ adb -s emulator-5556 logcat -v time System.err:V *:S | logcat-colorize
    
    # Piping to grep for regex filtering (much better than adb filter):
    $ adb logcat -v time | logcat-colorize | egrep -i '(sensor|wifi)'

    # Save logcat output to file and read later with logcat colorize.
    $ adb logcat > /tmp/logcat.txt
    $ cat /tmp/logcat.txt | logcat-colorize
    
    # List available formats, then set a specific format for debug messages.
    # Set in your ~/.bash_profile to make it permanent.
    $ logcat-colorize --list-ansi
    $ export LOGCAT_COLORIZE_MSG_DEBUG="^[4;44;33m"
    $ adb logcat | logcat-colorize

Note: I had written this as a quick approach in bash, but turns out it is pretty slow, specially pulling logcat from new devices (really a lot). So I decided to go a bit lower level and re-wrote this in C++. For reference, if you want to see the bash version, check out tag 0.2.0 (3f1486234a).

logcat-colorize's People

Contributors

carlonluca avatar marcuscalhoun-lopez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

logcat-colorize's Issues

Disable buffering in egrep

I like the idea of filtering the adb logcat streams with egrep, but I often get unresponsive output when it is in turn piped to logcat-colorize. Could you add the following line in README.md to disable grep buffering?

 # Piping to grep for regex filtering (much better than adb filter):
    $ adb logcat -v time | egrep --line-buffering -i '(sensor|wifi)' | logcat-colorize

FYI, here is the link to a similar issue on Stackoverflow:
https://stackoverflow.com/a/7162898/706334

the spotlight regex format not clear

I was trying to mark multiple words using thre spotlight regex.
My normal approach would be -s "foo|bar|baz" but that does not seem to work.
It looks like you are using the perl regex format (default in boost) but the boost_regex_replace seems to not allow this in the way you use it.

It been a while since i used the bloated boost lib, but I recall something about adding the following arguments to regex_replace: "boost::match_default | boost::format_all";

This might solve the problem

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.