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   31493 use Mojo::Base 'Mojo::Log';
  2         13434  
  2         13  
4 2     2   91294 use Time::Piece;
  2         16583  
  2         11  
5 2     2   144 use File::Spec;
  2         10  
  2         595  
6              
7             our $VERSION = '1.01';
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 1609 sub debug { shift->log(debug => @_, [caller($caller_depth)]) }
15 1     1 1 401 sub error { shift->log(error => @_, [caller($caller_depth)]) }
16 1     1 1 339 sub fatal { shift->log(fatal => @_, [caller($caller_depth)]) }
17 1     1 1 710 sub info { shift->log(info => @_, [caller($caller_depth)]) }
18 1     1 1 339 sub warn { shift->log(warn => @_, [caller($caller_depth)]) }
19              
20             sub _format {
21 5     5   389 my $caller = pop;
22 5         55 my $filename = (File::Spec->splitpath($caller->[1]))[2];
23              
24 5         17 sprintf "%s %s:%i %s> %s", localtime(shift)->datetime, $filename,
25             $caller->[2], uc(shift), join("\n", @_, '');
26             }
27              
28             1;
29              
30             __END__