line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
4017
|
use utf8; |
|
13
|
|
|
|
|
14
|
|
|
13
|
|
|
|
|
63
|
|
2
|
13
|
|
|
13
|
|
346
|
use strict; |
|
13
|
|
|
|
|
17
|
|
|
13
|
|
|
|
|
191
|
|
3
|
13
|
|
|
13
|
|
42
|
use warnings; |
|
13
|
|
|
|
|
14
|
|
|
13
|
|
|
|
|
395
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DR::Tnt::Role::Logging; |
6
|
13
|
|
|
13
|
|
4419
|
use Mouse::Role; |
|
13
|
|
|
|
|
12529
|
|
|
13
|
|
|
|
|
41
|
|
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; |