File Coverage

blib/lib/Log/Agent/Driver/Silent.pm
Criterion Covered Total %
statement 13 17 76.4
branch n/a
condition n/a
subroutine 5 14 35.7
pod 12 12 100.0
total 30 43 69.7


line stmt bran cond sub pod time code
1             ###########################################################################
2             #
3             # Silent.pm
4             #
5             # Copyright (C) 1999 Raphael Manfredi.
6             # Copyright (C) 2002-2015 Mark Rogaski, mrogaski@cpan.org;
7             # all rights reserved.
8             #
9             # See the README file included with the
10             # distribution for license information.
11             #
12             ##########################################################################
13              
14 1     1   1321 use strict;
  1         2  
  1         46  
15             require Log::Agent::Driver;
16              
17             ########################################################################
18             package Log::Agent::Driver::Silent;
19              
20 1     1   5 use vars qw(@ISA);
  1         1  
  1         302  
21              
22             @ISA = qw(Log::Agent::Driver);
23              
24             #
25             # ->make -- defined
26             #
27             # Creation routine.
28             #
29             sub make {
30 1     1 1 211 my $self = bless {}, shift;
31 1         4 return $self;
32             }
33              
34             #
35             # NOP routines.
36             #
37              
38       0 1   sub prefix_msg {}
39       0 1   sub emit {}
40 0     0 1 0 sub channel_eq { 1 }
41              
42             #
43             # In theory, we could live with the above NOP ops and the logxxx()
44             # routines would not do anything. Let's redefine them though...
45             #
46              
47       0 1   sub logerr {}
48       0 1   sub logwarn {}
49       0 1   sub logsay {}
50       0 1   sub logwrite {}
51       1 1   sub logxcarp {}
52              
53             #
54             # Those need minimal processing.
55             # We explicitely stringify the string argument (uses overloaded "" method)
56             #
57              
58 0     0 1 0 sub logconfess { require Carp; Carp::confess("$_[1]"); }
  0         0  
59 0     0 1 0 sub logdie { die "$_[0]\n"; }
60              
61             #
62             # ->logxcroak -- redefined
63             #
64             # Handle the offset parameter correctly
65             #
66             sub logxcroak {
67 1     1 1 2 my $self = shift;
68 1         2 my ($offset, $str) = @_;
69 1         6 require Carp;
70 1         9 my $msg = $self->carpmess($offset, $str, \&Carp::shortmess);
71 1         6 die "$msg\n";
72             }
73              
74             1; # for require
75             __END__