Recently it occurred to me that most of this work is designed to separate my program from the noise of the entire platform. The numeric argument printed after the tag in the logcat output is the pid responsible for that log line which I had used in the past to do this sort of filtering but it was a pain when the app crashed or was reinstalled because the pid would change.
Enter my proclogcat script. This script tracks the pid as the process is killed and restarted and takes care of automating the
adb shell ps | grep <process>
logic on first launch. The best part is the script can be combined with Jeffrey Sharkey's excellent coloredlogcat script (or my modified version of it) for beautiful results.Download: proclogcat
To use, simply copy it somewhere in your
PATH
and invoke either manually as adb logcat | proclogcat <process>
or in a function as is discussed in the script source code.