Skip to content

Colored logcat script which only shows log entries for a specific application package.

License

Notifications You must be signed in to change notification settings

anonfaded/pidcat

 
 

Repository files navigation

>_ pidcat: The Ultimate Logcat Companion 🚀

Colored Logcat Output

This project is an enhanced fork of the original pidcat script, revitalized with modern features for a cross-platform world.

Platforms

Its primary enhancements provide full Windows support and vastly improved user feedback, making Android debugging a seamless experience on any operating system.

✨ Key Features

  • 🖥️ Truly Cross-Platform: Works seamlessly on Windows, macOS, and Linux.
  • 🎨 Color-Coded Output: Makes logs scannable by color-coding tags and log levels (Verbose, Debug, Info, Warn, Error).
  • 📦 Smart Package Filtering: Automatically find an app's Process ID (PID) and show only relevant logs.
  • 🗣️ Verbose Feedback: The script tells you what it's doing! It confirms device connections, finds PIDs, and warns you if a specified app isn't running—no more silent failures.
  • 📱 Multiple Device Support: Interactive device selection when multiple devices are connected.
  • Windows Automation: Includes an interactive .bat script to automate your logging session with a double-click.
  • ⚙️ Powerful Filtering Options: Filter by minimum log level, specific tags, and more.

📸 Screenshots

Interactive Batch Script (Windows) Colored pidcat Output (Cross-Platform)
windows batch file pidcat output

🛠️ Prerequisites

Before you begin, ensure you have the following installed and configured:

  1. Python 3.6+
  2. Android SDK Platform-Tools: You must have adb.exe in your system's PATH.
  3. The colorama library: This is essential for colors on Windows. Install it by running:
    pip install colorama

🚀 Usage

Run the script from your terminal, providing the package name of the app you want to monitor.

python pidcat.py [OPTIONS] [PACKAGE_NAME]

Common Arguments

Argument Alias Description
package_name - The full package name of the app (e.g., com.example.app).
--clear -c Clears the logcat buffer before starting the session.
--min-level -l Sets the minimum log level to display (e.g., W for Warn).
--tag -t Filters for specific log tags (can be used multiple times).
--current - Attaches to the app currently in the foreground.

Windows

For Windows users, this project includes start_logcat.bat for an incredibly convenient workflow.

Features:

  • Interactive: Prompts you to enter a package name.
  • Smart Default: Suggests a default package if you just press Enter.
  • Auto-Clears: Automatically uses the -c flag to start a clean logging session.

How to Use:

  1. (First Time Only) Open start_logcat.bat in a text editor and ensure the path to pidcat.py is correct for your system.
  2. Double-click start_logcat.bat.
  3. Type a package name and press Enter. Your logcat session will begin instantly!

💡 Examples

Monitor a specific app with a clean buffer:

python pidcat.py -c com.yourapp.package

Show only Warnings and Errors from the current foreground app:

python pidcat.py --current -l W

Filter for multiple specific tags:

python pidcat.py -t "AuthService" -t "Database" com.yourapp.package

Original Project README

PID Cat

An update to Jeff Sharkey's excellent logcat color script 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 target package as the sole argument to the python script and enjoy a more convenient development process.

pidcat com.oprah.bees.android

Here is an example of the output when running for the Google Plus app:

Example screen

Install

Get the script:

  • OS X: Use Homebrew.

     brew install pidcat
    

    If you need to install the latest development version

    brew unlink pidcat
    brew install --HEAD pidcat
    
  • Arch Linux : Install the package called pidcat-git from the AUR.

  • Others: Download the pidcat.py and place it on your PATH.

Make sure that adb from the Android SDK 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.

To include adb and other android tools on your path:

export PATH=$PATH:<path to Android SDK>/platform-tools
export PATH=$PATH:<path to Android SDK>/tools

Include these lines in your .bashrc or .zshrc.

Note: <path to Android SDK> should be absolute and not relative.

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:

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

About

Colored logcat script which only shows log entries for a specific application package.

Resources

License

Stars

Watchers

Forks

Languages

  • Python 61.7%
  • Shell 26.5%
  • Batchfile 11.8%