| 1 | package Mojo::Log::More; | ||
| 2 | |||
| 3 | 2 | ▶ | use Mojo::Base 'Mojo::Log'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use Time::Piece; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use File::Spec; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | our $VERSION = '1.02'; | |
| 8 | |||
| 9 | # Increment this if you are using a wrapper | ||
| 10 | 2 | our $caller_depth = 0; | |
| 11 | |||
| 12 | 1 | ▶ | has format => sub { \&_format }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 1 | ▶ | sub debug { shift->emit('message', 'debug', @_, [caller($caller_depth)]) } |
|
Subroutine
debug: called CC=1 SCAR=0.0
Pod
documented
| |||
| 15 | 1 | ▶ | sub info { shift->emit('message', 'info', @_, [caller($caller_depth)]) } |
|
Subroutine
info: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | 1 | ▶ | sub warn { shift->emit('message', 'warn', @_, [caller($caller_depth)]) } |
|
Subroutine
warn: called CC=1 SCAR=0.0
Pod
documented
| |||
| 17 | 1 | ▶ | sub error { shift->emit('message', 'error', @_, [caller($caller_depth)]) } |
|
Subroutine
error: called CC=1 SCAR=0.0
Pod
documented
| |||
| 18 | 1 | ▶ | sub fatal { shift->emit('message', 'fatal', @_, [caller($caller_depth)]) } |
|
Subroutine
fatal: called CC=1 SCAR=0.0
Pod
documented
| |||
| 19 | |||
| 20 | 5 | ▶ | sub _format { |
|
Subroutine
_format: called CC=1 SCAR=0.0
| |||
| 21 | 5 | my $caller = pop; | |
| 22 | 5 | my $filename = (File::Spec->splitpath($caller->[1]))[2]; | |
| 23 | |||
| 24 | 5 | sprintf "%s %s:%i %s> %s", localtime(shift)->datetime, $filename, | |
| 25 | $caller->[2], uc(shift), join("\n", @_, ''); | ||
| 26 | } | ||
| 27 | |||
| 28 | 2 | 1; | |
| 29 | |||
| 30 | __END__ | ||