| 1 | package Log::ger::Format::Default; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||
| 7 | 1 | our $DATE = '2023-12-29'; # DATE | |||||||||||||
| 8 | 1 | our $DIST = 'Log-ger'; # DIST | |||||||||||||
| 9 | 1 | our $VERSION = '0.042'; # VERSION | |||||||||||||
| 10 | |||||||||||||||
| 11 | 0 | ▶ | sub meta { +{ | ||||||||||||
|
Subroutine
meta: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 12 | 0 | v => 2, | |||||||||||||
| 13 | } } | ||||||||||||||
| 14 | |||||||||||||||
| 15 | 0 | ▶ | sub get_hooks { | ||||||||||||
|
Subroutine
get_hooks: not called CC=1 SCAR=4.9
Pod
undocumented
| |||||||||||||||
| 16 | 0 | my %conf = @_; | |||||||||||||
| 17 | |||||||||||||||
| 18 | return { | ||||||||||||||
| 19 | create_formatter => [ | ||||||||||||||
| 20 | __PACKAGE__, # key | ||||||||||||||
| 21 | 50, # priority | ||||||||||||||
| 22 | 0 | ▶ | sub { # hook | ||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=4.7
| |||||||||||||||
| 23 | 0 | my %hook_args = @_; # see Log::ger::Manual::Internals/"Arguments passed to hook" | |||||||||||||
| 24 | |||||||||||||||
| 25 | |||||||||||||||
| 26 | my $formatter = | ||||||||||||||
| 27 | |||||||||||||||
| 28 | # the default formatter is sprintf-style that dumps data | ||||||||||||||
| 29 | # structures arguments as well as undef as '<undef>'. | ||||||||||||||
| 30 | 0 | ▶ | sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=32.7
| |||||||||||||||
| 31 | 0 | ▶ | return $_[0] if @_ < 2; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 32 | 0 | my $fmt = shift; | |||||||||||||
| 33 | 0 | my @args; | |||||||||||||
| 34 | 0 | for (@_) { | |||||||||||||
| 35 | 0 | ▶ | if (!defined($_)) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 36 | 0 | push @args, '<undef>'; | |||||||||||||
| 37 | } elsif (ref $_) { | ||||||||||||||
| 38 | 0 | ▶ | require Log::ger::Util unless $Log::ger::_dumper; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 39 | 0 | push @args, Log::ger::Util::_dump($_); | |||||||||||||
| 40 | } else { | ||||||||||||||
| 41 | 0 | push @args, $_; | |||||||||||||
| 42 | } | ||||||||||||||
| 43 | } | ||||||||||||||
| 44 | # redefine is just a dummy category for perls < 5.22 which | ||||||||||||||
| 45 | # don't have 'redundant' yet | ||||||||||||||
| 46 | 1 | ▶ | no warnings ($warnings::Bits{'redundant'} ? 'redundant' : 'redefine'); | ||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||
| 47 | 0 | sprintf $fmt, @args; | |||||||||||||
| 48 | 0 | }; | |||||||||||||
| 49 | |||||||||||||||
| 50 | 0 | [$formatter]; | |||||||||||||
| 51 | |||||||||||||||
| 52 | |||||||||||||||
| 53 | 0 | }], | |||||||||||||
| 54 | }; | ||||||||||||||
| 55 | } | ||||||||||||||
| 56 | |||||||||||||||
| 57 | 1 | 1; | |||||||||||||
| 58 | # ABSTRACT: Use default Log::ger formatting style | ||||||||||||||
| 59 | |||||||||||||||
| 60 | __END__ | ||||||||||||||