line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::ger::Output::LogAny; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-03-07'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Log-ger-Output-LogAny'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.007'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2741
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
207
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get_hooks { |
12
|
1
|
|
|
1
|
0
|
11
|
my %plugin_conf = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return { |
15
|
|
|
|
|
|
|
create_outputter => [ |
16
|
|
|
|
|
|
|
__PACKAGE__, # key |
17
|
|
|
|
|
|
|
50, # priority |
18
|
|
|
|
|
|
|
sub { # hook |
19
|
3
|
|
|
3
|
|
706
|
my %hook_args = @_; |
20
|
|
|
|
|
|
|
|
21
|
3
|
|
|
|
|
13
|
my $pkg; |
22
|
3
|
50
|
|
|
|
5
|
if ($hook_args{target_type} eq 'package') { |
|
|
0
|
|
|
|
|
|
23
|
3
|
|
|
|
|
5
|
$pkg = $hook_args{target_name}; |
24
|
|
|
|
|
|
|
} elsif ($hook_args{target_type} eq 'object') { |
25
|
0
|
|
|
|
|
0
|
$pkg = ref $hook_args{target_name}; |
26
|
|
|
|
|
|
|
} else { |
27
|
0
|
|
|
|
|
0
|
return []; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# use init_args as a per-target stash |
31
|
3
|
|
66
|
|
|
8
|
$hook_args{per_target_conf}{_la} ||= do { |
32
|
1
|
|
|
|
|
4
|
require Log::Any; |
33
|
1
|
|
|
|
|
5
|
Log::Any->get_logger(category => $pkg); |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
192
|
my $meth = $hook_args{str_level}; |
37
|
|
|
|
|
|
|
my $logger = sub { |
38
|
1
|
|
|
|
|
1411
|
my $ctx = shift; |
39
|
1
|
|
|
|
|
5
|
$hook_args{per_target_conf}{_la}->$meth(@_); |
40
|
3
|
|
|
|
|
21
|
}; |
41
|
3
|
|
|
|
|
17
|
[$logger]; |
42
|
1
|
|
|
|
|
6
|
}], |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
# ABSTRACT: Send logs to Log::Any |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |