line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5559
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Log::Any::Adapter::Log4perl; |
5
|
|
|
|
|
|
|
# ABSTRACT: Log::Any adapter for Log::Log4perl |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3
|
use Log::Log4perl 1.32; # bug-free wrapper_register available |
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
50
|
use Log::Any::Adapter::Util 1.03 qw(make_method); |
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
74
|
|
9
|
1
|
|
|
1
|
|
4
|
use base qw(Log::Any::Adapter::Base); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
411
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Ensure %F, %C, etc. skip Log::Any related packages |
14
|
|
|
|
|
|
|
Log::Log4perl->wrapper_register(__PACKAGE__); |
15
|
|
|
|
|
|
|
Log::Log4perl->wrapper_register("Log::Any::Proxy"); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub init { |
18
|
29
|
|
|
29
|
0
|
15585
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
|
20
|
29
|
|
|
|
|
72
|
$self->{logger} = Log::Log4perl->get_logger( $self->{category} ); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
foreach my $method ( Log::Any->logging_and_detection_methods() ) { |
24
|
|
|
|
|
|
|
my $log4perl_method = $method; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Map log levels down to log4perl levels where necessary |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
for ($log4perl_method) { |
29
|
|
|
|
|
|
|
s/notice/info/; |
30
|
|
|
|
|
|
|
s/warning/warn/; |
31
|
|
|
|
|
|
|
s/critical|alert|emergency/fatal/; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
make_method( |
35
|
|
|
|
|
|
|
$method, |
36
|
|
|
|
|
|
|
sub { |
37
|
51
|
|
|
51
|
|
11142
|
my $self = shift; |
38
|
51
|
|
|
|
|
122
|
return $self->{logger}->$log4perl_method(@_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |