line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Mini; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
190354
|
use strict; |
|
3
|
|
|
|
|
25
|
|
|
3
|
|
|
|
|
83
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
83
|
|
5
|
3
|
|
|
3
|
|
1511
|
use Module::Load qw/load/; |
|
3
|
|
|
|
|
3407
|
|
|
3
|
|
|
|
|
15
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Carp; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = "0.3.0"; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
12
|
|
|
|
|
|
|
{ |
13
|
8
|
|
|
8
|
0
|
17607
|
shift; |
14
|
8
|
|
|
|
|
17
|
my ($type, @args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
8
|
100
|
|
|
|
23
|
@args = () unless @args; |
17
|
|
|
|
|
|
|
|
18
|
8
|
100
|
|
|
|
20
|
$type = 'stderr' unless defined $type; |
19
|
|
|
|
|
|
|
|
20
|
8
|
100
|
|
|
|
27
|
if ($type eq 'file') { |
21
|
2
|
|
|
|
|
7
|
unshift(@args, $type); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
8
|
|
|
|
|
30
|
my $module_name = sprintf('Log::Mini::Logger::%s', uc($type)); |
25
|
8
|
|
|
|
|
12
|
my $logger; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
eval { |
28
|
8
|
|
|
|
|
21
|
load $module_name; |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
|
|
170
|
$logger = $module_name->new(@args); |
31
|
8
|
100
|
|
|
|
11
|
} or do { Carp::croak(sprintf("Failed to load adapter: %s, %s\n", $type, $@)) }; |
|
1
|
|
|
|
|
622
|
|
32
|
|
|
|
|
|
|
|
33
|
7
|
|
|
|
|
30
|
return $logger; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |