-
-
Save mxcl/448290 to your computer and use it in GitHub Desktop.
Makes ADB logcat more readible (for me)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
RED = "\033[0;31m" | |
RESET = "\033[0m" | |
YELLOW = "\033[0;33m" | |
BLUE = "\033[0;35m" | |
GREY = "\033[0;34m" | |
trap("INT") { puts; exit! 127 } | |
def stamp line | |
puts "#{Time.now.strftime '%H:%M:%S'}: #{line}" if line | |
end | |
IO.popen "adb logcat" do |pipe| | |
stamp case s = pipe.gets.strip | |
when /^E\/AndroidRuntime/, /E\/TweetDeck/ | |
if STDOUT.tty? | |
RED+s+RESET | |
else | |
s | |
end | |
when /^[EWDIV]\/ActivityManager\( *\d+\): .* com\.tweetdeck\.app/ | |
YELLOW+s+RESET | |
when /^[EWDIV]\/TweetDeck\( *(\d+)\)/ | |
pid = $1 | |
s | |
when /^D\/dalvikvm\( *(#{pid})\): GC_/ | |
BLUE+s+RESET | |
when /^[EWDIV]\/.*\( *(#{pid})\):/ | |
GREY+s+RESET | |
end until pipe.eof? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment