line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# this is only intended as an example. Most people have their own ideas of |
2
|
|
|
|
|
|
|
# what's important and what isn't in a log, so you'll want to highlight lines |
3
|
|
|
|
|
|
|
# differently. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package App::Tel::Color::CiscoLog; |
6
|
2
|
|
|
2
|
|
2003
|
use parent 'App::Tel::Color::Base'; |
|
2
|
|
|
|
|
257
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
121
|
use Term::ANSIColor; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
8
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
39
|
|
9
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
337
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head2 colorize |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $output = $self->colorize($input); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
colors a line of input |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub colorize { |
20
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
21
|
1
|
|
|
|
|
2
|
$_ = shift; |
22
|
1
|
|
|
|
|
4
|
s/((%SEC-6-IPACCESSLOGS|%SNMP-3-AUTHFAIL|%PFINIT-SP-5-CONFIG_SYNC).*)/sprintf("%s", colored($1, 'green'))/eg; |
|
0
|
|
|
|
|
0
|
|
23
|
1
|
|
|
|
|
7
|
s/((%SYS-5-CONFIG_I|%CONTROLLER-5-UPDOWN).*)/sprintf("%s", colored($1, 'red'))/eg; |
|
1
|
|
|
|
|
7
|
|
24
|
1
|
|
|
|
|
44
|
return $_; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |