LogDispatch.pm

filter: Statementstmt 97.5% 39 / 40 Branchbran 100% 4 / 4 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 4 / 4 Subroutinesub 91.6% 11 / 12 Podpod n/a totaltotal 96.9% 64 / 66 CC 5 SCAR 5.6
CC
5
Cov
98%
_build_logger
3.0
_build_configurator
3.0
__ANON__
1.1
CRAP 1.8
↑ Summary LogDispatch/Levels.pm »
1 package MooseX::LogDispatch;
2  
3 5 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 our $VERSION = '1.2002';
6  
7 5 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Log::Dispatch::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use MooseX::LogDispatch::ConfigMaker;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Moose::Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use MooseX::LogDispatch::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 Moose::Exporter->setup_import_methods(
14 as_is => [ \&MooseX::LogDispatch::Logger::Logger ]
15 );
16  
17 5 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 0 ▶my $ldc_type = subtype 'LogDispatchConfigurator' => as 'Object' => where { $_->isa('Log::Dispatch::Configurator') };
Subroutine __ANON__: not called CC=1 SCAR=1.2
20  
21 coerce 'LogDispatchConfigurator'
22 2 ▶ => from 'Str' => via {
Subroutine __ANON__: called CC=1 SCAR=0.0
23 2 require Log::Dispatch::Configurator::AppConfig;
24 2 Log::Dispatch::Configurator::AppConfig->new($_)
25 }
26 1 ▶ => from 'HashRef' => via { return MooseX::LogDispatch::ConfigMaker->new($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
27  
28  
29 5 has logger => (
30 isa => 'Log::Dispatch',
31 is => 'rw',
32 lazy_build => 1,
33 );
34  
35 5 has use_logger_singleton => (
36 isa => "Bool",
37 is => "rw",
38 default => 0,
39 );
40  
41 8 ▶sub _build_logger {
Subroutine _build_logger: called CC=3 SCAR=11.0
42 8 my $self = shift;
43  
44 8 ▶ unless ( Log::Dispatch::Config->__instance and $self->use_logger_singleton ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("Log::Dispatch::Config"->__instance and $self->use_logger_singleton) 7 1 8
Condition100%3/3
"Log::Dispatch::Config"->__instance and $self->use_logger_singleton
!ll&&!rl&&r
251
MC/DC100%2/2
"Log::Dispatch::Config"->__instance and $self->use_logger_singleton
"Log::Dispatch::Config"->__instance $self->use_logger_singleton
Truth table100%3/3
A and B
A= "Log::Dispatch::Config"->__instanceB= $self->use_logger_singleton
ABresult
0X0
100
111
45 7 Log::Dispatch::Config->configure( $self->_build_configurator );
46 }
47  
48 8 return Log::Dispatch::Config->instance;
49 }
50  
51 7 ▶sub _build_configurator {
Subroutine _build_configurator: called CC=3 SCAR=11.0
52 7 my $self = shift;
53 7 my $meta = $self->meta;
54  
55 7 ▶ my $conf_method =
Condition100%3/3
$self->can('log_dispatch_conf') || $self->can('config_filename')
l!l&&r!l&&!r
313
MC/DC100%2/2
$self->can('log_dispatch_conf') || $self->can('config_filename')
$self->can('log_dispatch_conf') $self->can('config_filename')
Truth table100%3/3
A || B
A= $self->can('log_dispatch_conf')B= $self->can('config_filename')
ABresult
1X1
011
000
56 $self->can('log_dispatch_conf') ||
57 $self->can('config_filename');
58  
59 7 ▶ return $ldc_type->coercion->coerce($self->$conf_method)
Branch: 1 branch
BranchTrueFalseTotal
if $conf_method 4 3 7
60 if $conf_method;
61  
62 3 return MooseX::LogDispatch::ConfigMaker->new({
63 class => 'Log::Dispatch::Screen',
64 min_level => 'debug',
65 stderr => 1,
66 format => '[%p] %m at %F line %L%n',
67 });
68 }
69  
70  
71 5 1;
72 __END__
↑ Summary LogDispatch/Levels.pm »