Skip to content

Instantly share code, notes, and snippets.

@obfusk
Last active December 1, 2020 19:27
Show Gist options
  • Select an option

  • Save obfusk/4ad83310af9b5c32215fd0094f4e4b49 to your computer and use it in GitHub Desktop.

Select an option

Save obfusk/4ad83310af9b5c32215fd0094f4e4b49 to your computer and use it in GitHub Desktop.
quick and dirty logcat for specific package only
#!/bin/bash
PACKAGE="$1" PIDS=()
adb logcat | while read -r _date _time pid _tid _prio tag data; do
data="${data#: }"
if [[ "$data" =~ ^'Start proc '([0-9]+):"$PACKAGE" ]]; then
PIDS+=( "${BASH_REMATCH[1]}" )
elif [[ " ${PIDS[*]} " =~ " $pid " ]]; then
printf '[%-20s] %s\n' "${tag%:}" "$data"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment