Commit Graph
92 Commits
Author SHA1 Message Date
imcarlost 468f625df4 Add interactive filter UI and finish the Python 3 port
Logs now render in a full-screen view above a bottom prompt line when both
stdin and stdout are a terminal; typing live-filters the scrollback to lines
containing every typed word, case-insensitively. --plain restores the
previous streaming output, and piped usage is unaffected either way.

Also finishes the Python 3 port that #177 and #173 started:

- print(linebuf.encode('utf-8')) printed the bytes repr of every line instead
  of the line itself
- named_processes was still a lazily-exhausted map() object after #177
  wrapped catchall_package in list()
- piping adb logcat into pidcat crashed, since FakeStdinProcess read
  sys.stdin (str) where the rest of the script expected bytes
- indent_wrap could hang given a non-positive wrap area
- the shebang invoked python, which does not exist on systems that only ship
  python3
2026-07-20 09:23:55 -04:00
Ozzie Fallick 389dacef01 Fixed Issue #147 to unbreak pidcat on Python 3.
Wrapped filter() calls with list() to restore previous functionality. This is backwards-compatible with Python 2.
2022-01-31 10:23:16 -08:00
Rajesh RamanandGitHub e77586b535 Convert system_dump to str for current app lookup
Fixes #172
2021-02-11 18:25:20 -08:00
Ross MacArthur 1a0a58bc60 Only output in color when stdout is a TTY 2020-07-24 17:16:50 +02:00
Harsh Shandilya e5fa59974b pidcat: make shebang more portable
Distros like NixOS[1] do not have a typical /usr/bin/, and rely on shebangs
using /usr/bin/env to go to the correct binary.

Passing options to interpreters is not directly supported in env, and thus
requires passing an extra -S [2] to ensure they go through correctly.

1: https://nixos.org
2: https://jhermann.github.io/blog/linux/know-how/2020/02/28/env_with_arguments.html

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2020-07-11 18:33:14 +05:30
William Gulian 99699dc78e Passthrough adb's stderr to the terminal. 2017-02-17 18:47:35 -05:00
Jake Wharton 44b4a106bb Update version and change log to 2.1.0. 2016-09-07 16:37:22 -04:00
Andrey Elizarov 48aaceea44 fix bug: '--tag-width 0' does not remove tags 2016-01-30 03:12:27 +03:00
Andrey Elizarov 9e2cca93e6 fix bug: '--tag-width 0' does not remove tags 2016-01-29 22:15:14 +03:00
rxwen 04ca2bd219 Fix bug: may fail to get target pid
if use ps_pid.poll() to check for termination condition, there is a
    race condition. consider this, the check for ps_pid.poll() succeed
    and continue to process the output. when the output is being
    processed, the "ps_pid" process terminated, generating some more
    output, which hasn't yet been read by pidcat process. after pidcat
    continues next loop iteration, the ps_pid.poll() check terminate the
    loop, and the remaining output is lost. if the target process's pid
    is in the lost output, then the target pid can't be retrieved.
2015-09-18 16:51:22 +08:00
rxwenandJake Wharton 0ef40cce9b Add -a/--all flag for showing all logs. 2015-08-22 15:05:56 -05:00
rxwenandJake Wharton 8e326454a2 allow package filter to match pattern like: /system/bin/native_app, so that we can use it for native app
and can print log messages from all packages
2015-08-22 15:02:38 -05:00
Jake Wharton 999ffa506d Merge pull request #99 from takahirom/master
Fix "--curent" bugs
2015-06-10 11:03:50 -04:00
David Wu 53306b82b3 explicitly run adb command in brief format 2015-06-06 11:14:02 +08:00
takahirom 9c90c7e474 fix clash lollipop and 2.x devices. 2015-05-27 23:39:24 +09:00
Jake Wharton 961ded1b1d Prepare version 2.0.0. 2015-05-25 17:52:07 -07:00
Jake Wharton a2604bb793 Change default tag length to 23. 2015-05-25 17:50:58 -07:00
takahiromandJake Wharton 215212683a add feature filter running app 2015-05-25 17:28:59 -07:00
Dario Marcato 95749e44a3 Allow tag filters with regex 2015-03-14 18:15:28 -07:00
Jake Wharton d85c10c25d Add support for Android 5.1. 2015-03-14 02:36:24 -04:00
Jake Wharton d23340de05 Merge pull request #88 from Pixplicity/master
Obtain unknown process IDs using `adb shell ps`
2015-02-17 17:56:36 -08:00
Anton Rieder c0620537c5 Add --version, remove trailing spaces in help texts 2015-02-17 14:11:25 +01:00
Paul Lammertsma e6fa71ef98 reintegrated pull request #71 (https://github.com/JakeWharton/pidcat/pull/71) onto master 2015-02-17 10:56:38 +01:00
laramaki fd999b79f7 Add ignore tag switch. Useful when inspecting the full log on over flooded log devices 2015-01-19 19:26:46 -02:00
Jake Wharton 4c79363e5a Support any number of spaces before the PID. 2014-10-07 14:10:01 -07:00
Adam Hupp 82c3305c7b Fix failure to match new format start messages
For low pids there's a space in front of the PID in the log message.
All my testing was on high pids :(
2014-10-06 17:18:08 -07:00
Adam Hupp 493e12a55c Handle alternative log format for process start
Some phones (like my samsung) do not log the 'Start proc ...' line in
logcat to indicate process start.  In my case it does log a line like

E/dalvikvm(pid): >>>>>> com.my.package [ more stuff ]

This commit adds support for that format to pidcat.
2014-10-01 10:20:35 -07:00
Adam Hupp 092ffc1869 Revert "Print line if we have not seen any pids created yet"
This reverts commit cd01ccf720.
2014-09-29 21:12:51 -07:00
Adam Stroud 3cfd3a839b Add support for tag(s) filtering 2014-08-19 14:02:23 -04:00
Brennan Taylor cd01ccf720 Print line if we have not seen any pids created yet
This specifically handles the case where you get a log snippet that may
not have any pid creation lines in it and pidcat ends up filtering
everything out. In this case we just print the line if we haven't seen
any pids yet.

An alternative would be allowing filter by pid, however I find grep
works fine for that.
2014-08-06 14:24:06 -07:00
Brennan Taylor 0827fafb44 When there is data on stdin we use it instead of adb 2014-07-15 13:32:36 -07:00
Brennan Taylor 1ed466123e Cleanup unused imports 2014-07-15 11:45:33 -07:00
Jaume Singla 78a1421215 min_level case unsensitive 2014-07-01 20:17:25 +02:00
wtud fee4b669cc Add -c to clear the log before starting logcat 2014-05-14 19:03:41 +02:00
Louis Boval f8ee064e89 Properly match process kill/death/leave messages for secondary processes
Summary: The regexes for process exits were no matching secondary processes, which makes it understandably hard to track their
lifecycles. Fix it by including ':' in the process name match groups, as in the process start regex.

Test Plan: Run, match the chrome process name, com.android.chrome, see its secondary processes start reporting their death.
2014-03-27 18:03:12 -07:00
Jake Wharton 2e1b3c9198 Merge pull request #51 from LouisBVL/process_parse
Allow package to specify a process as well …
2014-03-27 17:35:33 -07:00
Louis Boval 1900517819 [pidcat] Allow package to specify a process as well …
Summary: Android apps can use multiple processes (eg, chrome), which are identified as <package_name>:<process_name> in logs. The names are defined in the manifest.
The main process is referred to as simply <package_name> by android.
Add the ability to specify a target process as part of what was until now the package name in pidcat, or all processes if no process is specified.

Usage:
 * pidcat <package_name> will match all of an app's processes (catchall).
 * pidcat <package_name>:<process_name> will match a given named process.
 ** In particular, pidcat <package_name>: will ensure only the app's main/default process is matched.

Test Plan: Run the script, try out with no process, empty (aka default) process, named process. Try multiple entries.
2014-03-12 23:35:47 -07:00
Louis Boval 97b9c28813 [pidcat] Display package:process_name in process birth/death messages
Summary: Making sense of a birth/death message is made easier by specifying which process it applies to, and not just the component or the pid.

Test Plan: Run, monitor message lines when cycling a multi-process app, inject None as a process name to check resilience.
2014-03-12 23:27:39 -07:00
Omar A Rodriguez bb8701b514 Print backtrace after a native crash 2014-02-14 00:31:41 -08:00
Jake Wharton eda219681a Tweak header. 2014-01-09 15:54:03 -08:00
Aaron Simmons 5217c75ec0 making pidcat robust to when the loglevel isn't one of VDIWEF (!?) 2014-01-03 15:11:09 -07:00
Jake Wharton 4eb4e68392 Revert "Merge pull request #32 from thorikawa/fix_samsung_logcat_issue"
This reverts commit 87ad7dc1d9, reversing
changes made to aa6e3f0f69.
2013-12-02 00:50:08 -08:00
Jake Wharton 87ad7dc1d9 Merge pull request #32 from thorikawa/fix_samsung_logcat_issue
Use ps command to detect PIDs
2013-10-21 10:15:41 -07:00
colriot 41d3d4ccfc Made package arg optional. 2013-10-12 16:04:20 +02:00
Thura Hlaing 6b6034ab67 fixed unicode print bug 2013-09-23 16:16:35 +06:30
Thura Hlaing bf51754642 added option to always display tag name, so that we can pipe its output and filter by tags 2013-09-12 10:17:00 +06:30
Poly Takahiro Horikawa 98ff1fbf90 Add unit to interval constant name 2013-08-21 17:32:46 -07:00
Poly Takahiro Horikawa 675bfcf889 Add thread task to check ps command regularly 2013-08-21 16:27:10 -07:00
Poly Takahiro Horikawa 18674c501c Added pid initializer using ps command 2013-08-21 15:02:07 -07:00
mike castleman f643e4c3b4 Replace tabs with four spaces.
It appears that java stack dumps contain the tab character. This causes
line length computation to be messed up, so (on at least some
terminals), the lines end up wrapping twice -- once when we hit the
right edge of the terminal, and then again a few characters later when
indent_wrap() inserts a newline. By using spaces, where pidcat and the
terminal can agree on the width of the character, we obviate this
problem.
2013-07-18 16:38:04 -04:00