Log4perl/Appender/RRDs.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 31 CC 2 SCAR 12.0
CC
2
Cov
0%
new
6.0
log
2.0
BEGIN
2.0
CRAP 3.3
1 ##################################################
2 package Log::Log4perl::Appender::RRDs;
3 ##################################################
4 our @ISA = qw(Log::Log4perl::Appender);
5  
6 use warnings;
7 use strict;
8 use RRDs;
9  
10 ##################################################
11 sub new {
12 ##################################################
13 my($class, @options) = @_;
14  
15 my $self = {
16 name => "unknown name",
17 dbname => undef,
18 rrdupd_params => [],
19 @options,
20 };
21  
22 die "Mandatory parameter 'dbname' missing" unless
23 defined $self->{dbname};
24  
25 bless $self, $class;
26  
27 return $self;
28 }
29  
30 ##################################################
31 sub log {
32 ##################################################
33 my($self, %params) = @_;
34  
35 #print "UPDATE: '$self->{dbname}' - '$params{message}'\n";
36  
37 RRDs::update($self->{dbname},
38 @{$params{rrdupd_params}},
39 $params{message}) or
40 die "Cannot update rrd $self->{dbname} ",
41 "with $params{message} ($!)";
42 }
43  
44 1;
45  
46 __END__