File Coverage

lib/App/Tel/Color/CiscoLog.pm
Criterion Covered Total %
statement 18 19 94.7
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 24 25 96.0


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   2259 use parent 'App::Tel::Color::Base';
  2         287  
  2         12  
7 2     2   138 use Term::ANSIColor;
  2         4  
  2         93  
8 2     2   9 use strict;
  2         5  
  2         37  
9 2     2   10 use warnings;
  2         2  
  2         357  
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         3 $_ = shift;
22 1         10 s/((%SEC-6-IPACCESSLOGS|%SNMP-3-AUTHFAIL|%PFINIT-SP-5-CONFIG_SYNC).*)/sprintf("%s", colored($1, 'green'))/eg;
  0         0  
23 1         12 s/((%SYS-5-CONFIG_I|%CONTROLLER-5-UPDOWN).*)/sprintf("%s", colored($1, 'red'))/eg;
  1         11  
24 1         70 return $_;
25             }
26              
27             1;