line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
5733
|
use utf8; |
|
13
|
|
|
|
|
31
|
|
|
13
|
|
|
|
|
73
|
|
2
|
13
|
|
|
13
|
|
528
|
use strict; |
|
13
|
|
|
|
|
29
|
|
|
13
|
|
|
|
|
345
|
|
3
|
13
|
|
|
13
|
|
72
|
use warnings; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
561
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DR::Tnt::Role::Logging; |
6
|
13
|
|
|
13
|
|
6271
|
use Mouse::Role; |
|
13
|
|
|
|
|
20032
|
|
|
13
|
|
|
|
|
64
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has logger => |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
isa => 'CodeRef', |
11
|
|
|
|
|
|
|
default => sub { |
12
|
|
|
|
|
|
|
sub { |
13
|
|
|
|
|
|
|
my ($level, $msg) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
goto $level; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
warning: |
18
|
|
|
|
|
|
|
warn: |
19
|
|
|
|
|
|
|
error: |
20
|
|
|
|
|
|
|
warn "$level: $msg"; |
21
|
|
|
|
|
|
|
return; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
info: |
24
|
|
|
|
|
|
|
debug: |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _log { |
29
|
0
|
|
|
0
|
|
|
my ($self, $level, $fmt, @arg) = @_; |
30
|
0
|
0
|
|
|
|
|
return unless $self->logger; |
31
|
0
|
|
|
|
|
|
my $msg; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if (@arg) { |
34
|
0
|
|
|
|
|
|
$msg = sprintf $fmt, @arg; |
35
|
|
|
|
|
|
|
} else { |
36
|
0
|
|
|
|
|
|
$msg = $fmt; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
for ($msg) { |
40
|
0
|
|
|
|
|
|
s/\s*\z/\n/; |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
|
$self->logger->($level, $msg); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |