lib/DR/Tnt/Role/Logging.pm

filter: Statementstmt 45.1% 14 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 42.8% 18 / 42 SCAR 20.1
CC
4
Cov
40%
_log
20.0
__ANON__
2.0
__ANON__
1.1
CRAP 7.5
« lib/DR/Tnt/Client/AE.pm ↑ Summary lib/DR/Tnt/Client/Role/LikeSync.pm »
1 13 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package DR::Tnt::Role::Logging;
6 13 ▶use Mouse::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 has logger =>
9 is => 'rw',
10 isa => 'CodeRef',
11 default => sub {
12 sub {
13 0 ▶ my ($level, $msg) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
14  
15 0 goto $level;
16  
17 0 warning:
18 warn:
19 error:
20 0 warn "$level: $msg";
21 0 return;
22  
23 info:
24 debug:
25 0 }
26 0 ▶};
Subroutine __ANON__: not called CC=1 SCAR=1.2
27  
28 sub _log {
29 0 ▶ my ($self, $level, $fmt, @arg) = @_;
Subroutine _log: not called CC=4 SCAR=30.0
30 0 ▶ return unless $self->logger;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->logger 0 0 0
31 0 my $msg;
32  
33 0 ▶ if (@arg) {
Branch: 1 branch
BranchTrueFalseTotal
if (@arg) { } 0 0 0
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 13 1;
« lib/DR/Tnt/Client/AE.pm ↑ Summary lib/DR/Tnt/Client/Role/LikeSync.pm »