File Coverage

blib/lib/Log/ger/Output/DirWriteRotate.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 21 23 91.3


line stmt bran cond sub pod time code
1             package Log::ger::Output::DirWriteRotate;
2              
3             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
4             our $DATE = '2020-03-11'; # DATE
5             our $DIST = 'Log-ger-Output-DirWriteRotate'; # DIST
6             our $VERSION = '0.004'; # VERSION
7              
8 1     1   3878 use strict;
  1         3  
  1         24  
9 1     1   4 use warnings;
  1         2  
  1         161  
10              
11             sub meta { +{
12 1     1 0 16 v => 2,
13             } }
14              
15             sub get_hooks {
16 1     1 0 15 my %plugin_conf = @_;
17              
18 1         457 require Dir::Write::Rotate;
19 1         1605 my $dwr = Dir::Write::Rotate->new(%plugin_conf);
20              
21             return {
22             create_outputter => [
23             __PACKAGE__, # key
24             50, # priority
25             sub { # hook
26 6     6   1714 my %hook_args = @_; # see Log::ger::Manual::Internals/"Arguments passed to hook"
27              
28             my $outputter = sub {
29 2         7924 my ($per_target_conf, $fmsg, $per_msg_conf) = @_;
30 2         9 $dwr->write($fmsg);
31 6         20 };
32 6         15 [$outputter];
33 1         33 }],
34             };
35             }
36              
37             1;
38             # ABSTRACT: Log to Dir::Write::Rotate
39              
40             __END__