File Coverage

blib/lib/MooX/Log/Any.pm
Criterion Covered Total %
statement 10 11 90.9
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 15 17 88.2


line stmt bran cond sub pod time code
1             # ABSTRACT: Role to add Log::Any
2             package MooX::Log::Any;
3             our $VERSION = '0.004004'; #VERSION
4 1     1   11331 use Moo::Role;
  1         2  
  1         7  
5 1     1   319 use Log::Any;
  1         2  
  1         9  
6             local $| = 1;
7             has 'log' => (
8             is => 'ro',
9             lazy => 1,
10             default => sub { Log::Any->get_logger(category=>ref shift); },
11             );
12             sub logger {
13 1     1 1 1897 my $self=shift;
14 1         8 my $category=shift;
15 1 50       6 if (defined $category)
16             {
17 1         4 return Log::Any->get_logger(category=>$category);
18             }
19 0           return $self->log;
20             }
21             1;
22              
23             __END__