line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6444
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
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
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
41
|
use Log::Any::Adapter::Util qw(make_method); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
9
|
1
|
|
|
1
|
|
4
|
use base qw(Log::Any::Adapter::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
516
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
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
|
17333
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
|
20
|
29
|
|
|
|
|
88
|
$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
|
42
|
|
|
42
|
|
8390
|
my $self = shift; |
38
|
42
|
|
|
|
|
132
|
return $self->{logger}->$log4perl_method(@_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |