File Coverage

blib/lib/Log/ger/Output/Array.pm
Criterion Covered Total %
statement 16 16 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 22 25 88.0


line stmt bran cond sub pod time code
1             package Log::ger::Output::Array;
2              
3 4     4   25 use strict;
  4         6  
  4         110  
4 4     4   18 use warnings;
  4         5  
  4         829  
5              
6             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
7             our $DATE = '2022-06-10'; # DATE
8             our $DIST = 'Log-ger'; # DIST
9             our $VERSION = '0.040'; # VERSION
10              
11             sub meta { +{
12 5     5 0 16 v => 2,
13             } }
14              
15             sub get_hooks {
16 5     5 0 13 my %plugin_conf = @_;
17              
18 5 50       15 $plugin_conf{array} or die "Please specify array";
19              
20             return {
21             create_outputter => [
22             __PACKAGE__, # key
23             50, # priority
24             sub { # hook
25 54     54   126 my %hook_args = @_; # see Log::ger::Manual::Internals/"Arguments passed to hook"
26              
27             my $outputter = sub {
28 9         20 my ($per_target_conf, $msg, $per_msg_conf) = @_;
29 9         12 push @{$plugin_conf{array}}, $msg;
  9         22  
30 54         169 };
31 54         136 [$outputter];
32 5         33 }],
33             };
34             }
35              
36             1;
37             # ABSTRACT: Log to array
38              
39             __END__