App-logcat_format
view release on metacpan or search on metacpan
lib/App/logcat_format.pm view on Meta::CPAN
[ 'emulator|e', "connect to emulator", ],
[ 'device|d', "connect to device", ],
[],
[ 'help|h', "print usage message and exit" ],
);
print($usage->text), exit if $opt->help;
my %priority =
(
V => 'bold black on_bright_white', # Verbose
D => 'bold black on_bright_blue', # Debug
I => 'bold black on_bright_green', # Info
W => 'bold black on_bright_yellow', # Warn
E => 'bold black on_bright_red', # Error
F => 'bold white on_black', # Fatal
S => 'not printed', # Silent
);
my %known_tags =
(
dalvikvm => 'bright_blue',
PackageManager => 'cyan',
ActivityManager => 'blue',
);
lib/App/logcat_format.pm view on Meta::CPAN
(?<priority>V|D|I|W|E|F|S)
\/
(?<tag>.+?)
\(\s{0,5}
(?<pid>\d{1,5})
\):\s
(?<log>.*)
$!xms )
{
# 'BRIEF' format
print colored( sprintf( " %5s ", $+{pid} ), 'bold black on_grey9' );
print colored( sprintf( " %s ", $+{priority} ), "bold $priority{ $+{priority} }" );
print colored( sprintf( " %25s ", tag_format( $+{tag} ) ), tag_colour( $+{tag} ) );
print colored( sprintf( " %s", log_format( $+{log}, 39 ) ), 'white' );
print "\n";
}
elsif ( $line =~ m!^
(?<priority>V|D|I|W|E|F|S)
\(\s{0,}?
(?<pid>\d{1,5})
\){1}\s{1}
(?<log>.*)
\s{1,}?\(
(?<tag>.+?)
\)\s{1,}?
$!xms )
{
# 'PROCESS' format
print colored( sprintf( " %5s ", $+{pid} ), 'bold black on_grey9' );
print colored( sprintf( " %s ", $+{priority} ), "bold $priority{ $+{priority} }" );
print colored( sprintf( " %25s ", tag_format( $+{tag} ) ), tag_colour( $+{tag} ) );
print colored( sprintf( " %s", log_format( $+{log}, 39 ) ), 'white' );
print "\n";
}
elsif ( $line =~ m!^
(?<priority>V|D|I|W|E|F|S)
\/
(?<tag>.+?)
:\s{1}
(?<log>.*)
$!xms )
{
# 'TAG' format
print colored( sprintf( " %s ", $+{priority} ), "bold $priority{ $+{priority} }" );
print colored( sprintf( " %25s ", tag_format( $+{tag} ) ), tag_colour( $+{tag} ) );
print colored( sprintf( " %s", log_format( $+{log}, 32 ) ), 'white' );
print "\n";
}
elsif ( $line =~ m!^
(?<date>\d\d-\d\d)
\s
(?<time>\d\d:\d\d:\d\d\.\d\d\d)
\s
(?<priority>V|D|I|W|E|F|S)
\/
(?<tag>.+)
\(\s*
(?<pid>\d{1,5})
\):\s
(?<log>.*)
$!xms )
{
# 'TIME' format
print colored( sprintf( " %5s ", $+{time} ), 'bold black on_grey12' );
print colored( sprintf( " %5s ", $+{date} ), 'bold black on_grey7' );
print colored( sprintf( " %5s ", $+{pid} ), 'bold black on_grey9' );
print colored( sprintf( " %s ", $+{priority} ), "bold $priority{ $+{priority} }" );
print colored( sprintf( " %25s ", tag_format( $+{tag} ) ), tag_colour( $+{tag} ) );
print colored( sprintf( " %s", log_format( $+{log}, 60 ) ), 'white' );
print "\n";
}
elsif ( $line =~ m/^
(?<date>\d\d-\d\d)
\s
(?<time>\d\d:\d\d:\d\d\.\d\d\d)
\s{1,5}
(?<pid>\d{1,5})
lib/App/logcat_format.pm view on Meta::CPAN
(?<tid>\d{1,5})
\s
(?<priority>V|D|I|W|E|F|S)
\s
(?<tag>.+?)
:\s{1,}?
(?<log>.*)
$/xms )
{
# 'THREADTIME' format
print colored( sprintf( " %5s ", $+{time} ), 'bold black on_grey12' );
print colored( sprintf( " %5s ", $+{date} ), 'bold black on_grey7' );
print colored( sprintf( " %5s ", $+{pid} ), 'bold black on_grey9' );
print colored( sprintf( " %5s ", $+{tid} ), 'bold black on_grey10' );
print colored( sprintf( " %s ", $+{priority} ), "bold $priority{ $+{priority} }" );
print colored( sprintf( " %25s ", tag_format( $+{tag} ) ), tag_colour( $+{tag} ) );
print colored( sprintf( " %s", log_format( $+{log}, 67 ) ), 'white' );
print "\n";
}
else
{
print "$line\n";
}
}
( run in 0.804 second using v1.01-cache-2.11-cpan-5dc5da66d9d )