File Coverage

blib/lib/Amon2/Plugin/LogDispatch.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition 1 2 50.0
subroutine 7 7 100.0
pod 0 1 0.0
total 28 30 93.3


line stmt bran cond sub pod time code
1             package Amon2::Plugin::LogDispatch;
2 2     2   34983 use strict;
  2         5  
  2         79  
3 2     2   11 use warnings;
  2         3  
  2         60  
4 2     2   51 use 5.008001;
  2         12  
  2         130  
5             our $VERSION = '0.01';
6              
7 2     2   945 use Log::Dispatch ();
  2         23990  
  2         46  
8 2     2   1150 use Amon2::Util ();
  2         36566  
  2         305  
9              
10             sub init {
11 1     1 0 13 my ($class, $c, $config) = @_;
12              
13 1   50     10 my $conf = $c->config->{'Log::Dispatch'}
14             || die "missing configuration for LogDispatch plugin(\$c->config->{'Log::Dispatch'} is undefined)";
15 1         38 my $logger = Log::Dispatch->new(%$conf);
16 1     2   3597 Amon2::Util::add_method($c, 'log', sub { $logger });
  2         50  
17             }
18              
19             1;
20             __END__