Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logcat-viewer

A lightweight terminal logcat viewer for Android emulators / devices, with live filtering. Streams adb logcat, parses it, color-codes by severity, and lets you filter by regex, app (package), tag, PID, and level — all live, with pause, clear, follow-tail, and export.

No build step. One dependency (neo-blessed). Pure Node.

┌─ logcat ─────────── emulator-5554 ● streaming ──┐
│ 16:52:45 I NullBinder  NullBinder for android…  │
│ 16:52:45 I UsageStats  Flushing usage stats…    │
│ 16:52:46 D EGL_emul…   app_time_stats: avg=…    │
│ 16:52:48 W .gms.pers…  Large reply transaction… │
└──────────────────────────────────────────────────┘
 / search · a app · t tag · p pause · c clear · s export · q quit

Requirements

  • Node.js ≥ 18
  • adb on your PATH, or the standard Android SDK location (~/Library/Android/sdk/platform-tools/adb on macOS). The default SDK locations for Linux/Windows are also probed.
  • At least one running emulator or attached device.

Install

cd logcat-viewer
npm install

Optionally link it as a global command:

npm link        # then run `logcat-viewer` anywhere

Usage

node bin/logcat-viewer.js [options]

If exactly one device is attached it is selected automatically. With several, pass --device, or pick from the list shown at startup.

Options

Option Description
-s, --device <serial> Target device serial (e.g. emulator-5554).
-p, --package <pkg> Start filtered to an app's process(es) (e.g. com.izhandroid.financo).
-g, --grep <regex> Start with a search filter applied.
-l, --level <V|D|I|W|E|F> Minimum severity to show.
-b, --buffer <list> Logcat buffers, comma-separated (main,system,crash,radio,events,kernel,all). Default: adb's default set.
-m, --max-lines <n> Ring-buffer size (default 50000).
-c, --clear Clear the device log buffer (adb logcat -c) before streaming.
-H, --history Replay the existing log buffer on open. By default the viewer streams only new logs (-T 1) instead of dumping the whole backlog.
-h, --help Show help.

Keybindings

Key Action
/ Search — type a regex (falls back to literal substring if invalid). Enter apply, Esc cancel.
a App picker — filter to an installed package's process(es).
t Tag filter — type a tag substring.
p Pause / resume the stream.
c Clear the view.
f Toggle follow-tail (autoscroll).
s Export the currently filtered lines to logcat-export-<timestamp>.log.
16 Toggle severity V / D / I / W / E / F.
0 Reset all filters.
g / G Jump to top / bottom.
↑ ↓ / PgUp PgDn / mouse wheel Scroll.
q / Ctrl-C Quit.

How it works

adb logcat -v threadtime ──▶ parser ──▶ store (ring buffer + filters) ──▶ TUI
  • parser turns each threadtime line into {date,time,pid,tid,level,tag,msg}, attaching multi-line continuations (stack traces) to their parent entry.
  • store keeps a bounded ring buffer and a single matches() predicate combining level / regex / tag / PID filters.
  • app filter resolves package → PID via pidof and re-polls every couple of seconds, so the filter keeps working across app restarts (when PIDs change).
  • The UI repaints on a throttled interval rather than per-line, so it stays smooth under heavy log volume.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages