color the lines of logcat on Linux [android]

13,326

Solution 1

Link with script

I think it will be useful for you and you can change script by yourself;)

Solution 2

adb logcat -v color

from developer.android.com

Solution 3

This is my view of "colorizing" the logcat: https://bitbucket.org/brunobraga/logcat-colorize

enter image description here

Solution 4

My favourite is pidcat, maintained by Jake Wharton based off of Jeff Sharkey's script (mentioned by Yaroslav Boichuk).

I have also used logcat-color, maintained by Marshall Culpepper, (also based off of Jeff's script) which allows you to create profiles you can activate (log per task, or per application, etc).

I have preferred pidcat because at the time logcat-color wouldn't filter by package name, and I never went back to try again once it was added. Seems to be reasonably popular still as well.

Solution 5

And yet another script:

#!/bin/sh
while :; do 
    adb $@ logcat | sed \
    -e 's:^V/:\x00\x1b[0;35m:g'  \
    -e 's:^D/:\x00\x1b[0;36m:g'  \
    -e 's:^I/:\x00\x1b[0;32m:g'  \
    -e 's:^W/:\x00\x1b[0;33m:g'  \
    -e 's:^E/:\x00\x1b[0;31m:g'  \
    -e 's:^F/:\x00\x1b[0;31m:g'  \
    -e '/Unexpected value from nativeGetEnabledTags/d' \
    -e '/The application may be/d'
   sleep 1
done
Share:
13,326
Sephy
Author by

Sephy

Free s/Lance/Spirit Frontender with a touch of backend culture (Fullstack :D ? ) Enjoys playing with all the crazy stuff going about the web platform (React, React Native, new Web APIs, Angular, NodeJs ...)

Updated on June 03, 2022

Comments

  • Sephy
    Sephy almost 2 years

    The Logcat in Eclipse has colors for errors, warning, debug, ...
    How can I do to get the same result on Linux (Ubuntu) when I run the command 'adb -e logcat' in a terminal to get it colored?