File Coverage

blib/lib/Log/ger/Layout/Pattern/Multiline.pm
Criterion Covered Total %
statement 22 22 100.0
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 30 32 93.7


line stmt bran cond sub pod time code
1             package Log::ger::Layout::Pattern::Multiline;
2              
3             our $DATE = '2019-10-27'; # DATE
4             our $VERSION = '0.003'; # VERSION
5              
6 1     1   2157 use 5.010001;
  1         3  
7 1     1   5 use strict;
  1         2  
  1         17  
8 1     1   4 use warnings;
  1         1  
  1         20  
9              
10 1     1   403 use Log::ger::Layout::Pattern ();
  1         3544  
  1         171  
11              
12             sub _layout {
13 3     3   5 my $format = shift;
14 3         5 my $msg = shift;
15             #my ($init_args, $lvlnum, $lvlname) = @_;
16              
17             join(
18             "\n",
19             map {
20 3         12 Log::ger::Layout::Pattern::_layout($format, [], [], $_, @_)
  5         81  
21             }
22             split(/\R/, $msg)
23             );
24             }
25              
26             sub get_hooks {
27 3     3 0 4914 my %conf = @_;
28              
29 3 50       9 $conf{format} or die "Please specify format";
30              
31             return {
32             create_layouter => [
33             __PACKAGE__, # key
34             50, # priority
35             sub { # hook
36 3     3   439 my %hook_args = @_;
37              
38             my $layouter = sub {
39 3         2922 _layout($conf{format}, @_);
40 3         8 };
41 3         8 [$layouter];
42 3         18 }],
43             };
44             }
45              
46             1;
47             # ABSTRACT: Pattern layout (with multiline message split)
48              
49             __END__