File Coverage

blib/lib/Mojo/Log/More.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 5 5 100.0
total 31 31 100.0


line stmt bran cond sub pod time code
1             package Mojo::Log::More;
2              
3 2     2   31743 use Mojo::Base 'Mojo::Log';
  2         13209  
  2         13  
4 2     2   87686 use Time::Piece;
  2         15771  
  2         11  
5 2     2   160 use File::Spec;
  2         10  
  2         825  
6              
7             our $VERSION = '1.00';
8              
9             # Increment this if you are using a wrapper
10             our $caller_depth = 0;
11              
12             has format => sub { \&_format };
13              
14 1     1 1 2129 sub debug { shift->log(debug => @_, [caller($caller_depth)]) }
15 1     1 1 552 sub error { shift->log(error => @_, [caller($caller_depth)]) }
16 1     1 1 570 sub fatal { shift->log(fatal => @_, [caller($caller_depth)]) }
17 1     1 1 1017 sub info { shift->log(info => @_, [caller($caller_depth)]) }
18 1     1 1 675 sub warn { shift->log(warn => @_, [caller($caller_depth)]) }
19              
20             sub _format {
21 5     5   714 my $caller = pop;
22 5         93 my $filename = (File::Spec->splitpath($caller->[1]))[2];
23              
24 5         23 sprintf "%s %s:%i %s> %s", localtime(shift)->datetime, $filename,
25             $caller->[2], uc(shift), join("\n", @_, '');
26             }
27              
28             1;
29              
30             __END__