view adb logcat with pretty color
in bash/zsh environment
$ chmod +x ./logcat.sh
$ ./logcat.sh
- skip line matches keyword in skip list, default is empty
- dim line matches keyword in dim list, default is empty
- if line start with E ( match
grep ^E
), print in red color - if line start with W ( match
grep ^W
), print in yellow color - otherwise, print line in default color
-c | --clear : run adb logcat -c at begining
-d | --dim : add (grep) keyword to dim list, line will be colored dim/black
-s | --skip : add (grep) keyword to skip list, line will be skipped
: if provided, script will run in positive mode, which filter postpend array out first
$ ./logcat.sh -c -s ^T -s ^I -d SocketStream
will
- run adb logcat -c at beginning
- skip T(Trace) log
- skip I(Info) log
- when line contains "SocketStream", dim it
- print ^E in red, ^W in yellow, others in default color
$ ./logcat.sh asi
will
- fliter line contians asi, skip the other
- print ^E in red, ^W in yellow, others in default color