line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Any::Adapter::Log4perlTiny; |
2
|
2
|
|
|
2
|
|
96698
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
48
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
91
|
|
4
|
|
|
|
|
|
|
{ our $VERSION = '0.001' } |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
840
|
use Log::Log4perl::Tiny qw< :dead_if_first LEVELID_FOR >; |
|
2
|
|
|
|
|
23184
|
|
|
2
|
|
|
|
|
9
|
|
7
|
2
|
|
|
2
|
|
578
|
use Log::Any::Adapter::Util (); |
|
2
|
|
|
|
|
6763
|
|
|
2
|
|
|
|
|
37
|
|
8
|
2
|
|
|
2
|
|
364
|
use parent 'Log::Any::Adapter::Base'; |
|
2
|
|
|
|
|
235
|
|
|
2
|
|
|
|
|
10
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $logger = Log::Log4perl::Tiny->get_logger; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# map stuff, rest goes to fatal |
15
|
|
|
|
|
|
|
my %level_for = ( |
16
|
|
|
|
|
|
|
notice => 'info', |
17
|
|
|
|
|
|
|
warning => 'warn', |
18
|
|
|
|
|
|
|
(map { $_ => $_ } qw< trace debug info warn error fatal >), |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %id_for = |
22
|
|
|
|
|
|
|
map { $_ => LEVELID_FOR(uc($level_for{$_})) } keys(%level_for); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub structured { |
25
|
2
|
|
|
2
|
1
|
66
|
my ($self, $level, $category, @args) = @_; |
26
|
2
|
|
|
|
|
4
|
local $Log::Log4perl::Tiny::caller_depth = |
27
|
|
|
|
|
|
|
$Log::Log4perl::Tiny::caller_depth + 2; |
28
|
2
|
|
33
|
|
|
11
|
$logger->log($id_for{$level} || $id_for{fatal}, @args); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
for my $method (Log::Any::Adapter::Util::detection_methods()) { |
32
|
|
|
|
|
|
|
my $level = $level_for{substr($method, 3)} || 'fatal'; |
33
|
|
|
|
|
|
|
my $delegated = $logger->can("is_$level"); |
34
|
2
|
|
|
2
|
|
1214
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
144
|
|
35
|
2
|
|
|
2
|
|
2946
|
*{$method} = sub { $logger->$delegated } |
36
|
|
|
|
|
|
|
} ## end for my $method (Log::Any::Adapter::Util::detection_methods...) |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |