README.md 2.1 KB
Newer Older
J
Jake Wharton 已提交
1 2 3 4 5 6 7 8 9 10 11
PID Cat
=======

An update to Jeff Sharkey's excellent [logcat color script][1] which only shows
log entries for processes from a specific application package.

During application development you often want to only display log messages
coming from your app. Unfortunately, because the process ID changes every time
you deploy to the phone it becomes a challenge to grep for the right thing.

This script solves that problem by filtering by application package. Supply the
J
Jake Wharton 已提交
12
target package as the sole argument to the python script and enjoy a more
J
Jake Wharton 已提交
13 14
convenient development process.

J
Jake Wharton 已提交
15
    pidcat com.oprah.bees.android
J
Jake Wharton 已提交
16 17


J
Jake Wharton 已提交
18
Here is an example of the output when running for the Google Plus app:
J
Jake Wharton 已提交
19 20 21 22

![Example screen](screen.png)


J
Jake Wharton 已提交
23 24 25
Install
-------

26 27
Get the script:

J
Jake Wharton 已提交
28 29 30 31
 *  OS X: Use [Homebrew][2].

         brew install pidcat

J
Jean-Michel Fayard 已提交
32 33
    If you need to install the latest development version

34
        brew unlink pidcat
35
        brew install --HEAD pidcat
36

P
Pedro Veloso 已提交
37
 * Arch Linux : Install the package called `pidcat-git` from the [AUR][4].
38

J
Jake Wharton 已提交
39 40 41
 * Others: Download the `pidcat.py` and place it on your PATH.


42 43 44 45
Make sure that `adb` from the [Android SDK][3] is on your PATH. This script will
not work unless this is that case. That means, when you type `adb` and press
enter into your terminal something actually happens.

46 47
To include `adb` and other android tools on your path:

D
Danny Fürniß 已提交
48
    export PATH=$PATH:<path to Android SDK>/platform-tools
49 50
    export PATH=$PATH:<path to Android SDK>/tools

51
Include these lines in your `.bashrc` or `.zshrc`.
J
Jake Wharton 已提交
52

53
*Note:* `<path to Android SDK>` should be absolute and not relative.
J
Jake Wharton 已提交
54

55 56 57 58 59 60 61 62 63 64
`pidcat` requires at least version 8.30 of `coreutils`. Ubuntu 20.04 LTS already ships
with it, for 18.04 and below, `coreutils` can be upgraded from the `focal` repo by running
the following:

```shell
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse'
sudo apt-get update
sudo apt-get -t focal install coreutils
```

J
Jake Wharton 已提交
65
 [1]: http://jsharkey.org/blog/2009/04/22/modifying-the-android-logcat-stream-for-full-color-debugging/
J
Jake Wharton 已提交
66
 [2]: http://brew.sh
67
 [3]: http://developer.android.com/sdk/
P
Pedro Veloso 已提交
68
 [4]: https://aur.archlinux.org/packages/pidcat-git/