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             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
4             our $DATE = '2021-01-31'; # DATE
5             our $DIST = 'Log-ger'; # DIST
6             our $VERSION = '0.038'; # VERSION
7              
8 4     4   31 use strict;
  4         8  
  4         133  
9 4     4   21 use warnings;
  4         8  
  4         765  
10              
11             sub meta { +{
12 5     5 0 19 v => 2,
13             } }
14              
15             sub get_hooks {
16 5     5 0 14 my %plugin_conf = @_;
17              
18 5 50       16 $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   151 my %hook_args = @_; # see Log::ger::Manual::Internals/"Arguments passed to hook"
26              
27             my $outputter = sub {
28 9         21 my ($per_target_conf, $msg, $per_msg_conf) = @_;
29 9         13 push @{$plugin_conf{array}}, $msg;
  9         29  
30 54         213 };
31 54         151 [$outputter];
32 5         42 }],
33             };
34             }
35              
36             1;
37             # ABSTRACT: Log to array
38              
39             __END__