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
|
|
1270
|
use parent 'App::Tel::Color::Base'; |
|
2
|
|
|
|
|
300
|
|
|
2
|
|
|
|
|
9
|
|
7
|
2
|
|
|
2
|
|
100
|
use Term::ANSIColor; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
70
|
|
8
|
2
|
|
|
2
|
|
6
|
use strict; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
25
|
|
9
|
2
|
|
|
2
|
|
4
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
265
|
|
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
|
2
|
my ($self, $text) = @_; |
21
|
1
|
|
|
|
|
5
|
$text =~ s/((%SEC-6-IPACCESSLOGS|%SNMP-3-AUTHFAIL|%PFINIT-SP-5-CONFIG_SYNC).*)/sprintf("%s", colored($1, 'green'))/eg; |
|
0
|
|
|
|
|
0
|
|
22
|
1
|
|
|
|
|
5
|
$text =~ s/((%SYS-5-CONFIG_I|%CONTROLLER-5-UPDOWN).*)/sprintf("%s", colored($1, 'red'))/eg; |
|
1
|
|
|
|
|
5
|
|
23
|
1
|
|
|
|
|
26
|
return $text; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |