Colorizing adb output

Although I quite like most of the IDE functionality Eclipse has to offer, there’s one thing I positively hate about it: under linux the UI elements are HUGE, leaving less room for the code you’re writing. The things that bother me most are the editor-tabs (they’re mostly too high for my taste) and the status bar at the bottom (why is that thing even there?).

I haven’t yet figured out how to fix the above things, but I did find a nice solution for another thing that crept up recently: the logcat output window. The ratio between UI elements and actual content is way off here, especially since there’s no way to hide the search bar and icons:

But log output is important: you really want to know what’s going on when you’re running/debugging your program. Since I had an old PowerBook G4 lying around I figured I look into running adb logcat from an ssh shell and use that as a replacement for the Eclipse window. Turns out that the readability of logcat’s output stinks. Without resorting to *nix trickery it won’t even let you filter on package (TAGs are not packages!!)!

So how to deal with this dire situation? Apparently Jeff Sharkey was bothered by the same thing a while back and wrote a nice Python script that colorizes the logcat output (thanks Jeff!). Combine that with a little grep and you’ve got a nice logging setup:
adb logcat | grep your.package.name | ~/coloredlogcat.py

Update:
While using the above command, I noticed some irregularities: entries not appearing on the console where they should be. After some digging (“tee” for the win!) I found that this was due to the lack of line buffering in grep. Which is easily fixed once you know what to look for:
adb logcat | grep --line-buffered your.package.name | ~/coloredlogcat.py