line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::ger::Like::LogAny; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-03-11'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Log-ger-Like-LogAny'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.006'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# IFUNBUILT |
9
|
|
|
|
|
|
|
# use strict 'subs', 'vars'; |
10
|
|
|
|
|
|
|
# use warnings; |
11
|
|
|
|
|
|
|
# END IFUNBUILT |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
62584
|
use Log::ger::Level::Like::LogAny; |
|
1
|
|
|
|
|
1620
|
|
|
1
|
|
|
|
|
179
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_logger { |
16
|
2
|
|
|
2
|
0
|
6
|
my ($package, %args) = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
4
|
my $caller = caller(0); |
19
|
2
|
|
|
|
|
10
|
require Log::ger; |
20
|
2
|
|
|
|
|
438
|
require Log::ger::Plugin; |
21
|
2
|
|
|
|
|
5773
|
my $log = Log::ger->get_logger(category => $caller, %args); |
22
|
2
|
|
|
|
|
5688
|
Log::ger::Plugin->set({ |
23
|
|
|
|
|
|
|
name => 'LogAny', |
24
|
|
|
|
|
|
|
target => 'object', |
25
|
|
|
|
|
|
|
target_arg => $log, |
26
|
|
|
|
|
|
|
}); |
27
|
2
|
|
|
|
|
7580
|
$log; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub import { |
31
|
2
|
|
|
2
|
|
19
|
my $package = shift; |
32
|
|
|
|
|
|
|
|
33
|
2
|
100
|
66
|
|
|
76
|
if (@_ && $_[0] eq '$log') { |
34
|
1
|
|
|
|
|
2
|
shift; |
35
|
1
|
|
|
|
|
4
|
my $caller = caller(0); |
36
|
1
|
|
|
|
|
2
|
my $log = __PACKAGE__->get_logger(category => $caller, @_); |
37
|
1
|
|
|
|
|
3
|
*{"$caller\::log"} = \$log; |
|
1
|
|
|
|
|
92
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
package |
42
|
|
|
|
|
|
|
Log::Any; # hide from PAUSE |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
unless (defined(&{"get_logger"})) { |
45
|
1
|
|
|
1
|
|
25
|
sub get_logger { goto &Log::ger::Like::LogAny::get_logger } |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
# ABSTRACT: Log like Log::Any |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |