| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Log::ger::Output::LogDispatchOutput; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2017-08-03'; # DATE |
|
4
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1261
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
25
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Log::ger::Util; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
210
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get_hooks { |
|
12
|
1
|
|
|
1
|
0
|
12
|
my %conf = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
50
|
|
|
|
4
|
$conf{output} or die "Please specify output (e.g. ". |
|
15
|
|
|
|
|
|
|
"ArrayWithLimits for Log::Dispatch::ArrayWithLimits)"; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
280
|
require Log::Dispatch; |
|
18
|
1
|
|
|
|
|
200408
|
my $mod = "Log::Dispatch::$conf{output}"; |
|
19
|
1
|
|
|
|
|
6
|
(my $mod_pm = "$mod.pm") =~ s!::!/!g; |
|
20
|
1
|
|
|
|
|
86
|
require $mod_pm; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return { |
|
23
|
|
|
|
|
|
|
create_logml_routine => [ |
|
24
|
|
|
|
|
|
|
__PACKAGE__, 50, |
|
25
|
|
|
|
|
|
|
sub { |
|
26
|
0
|
|
|
0
|
|
|
my %args = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $logger = sub { |
|
29
|
0
|
|
|
|
|
|
my ($ctx, $level, $msg) = @_; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
return if $level > $Log::ger::Current_Level; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# we can use init_args to store per-target stuffs |
|
34
|
|
|
|
|
|
|
$args{init_args}{_ld} ||= Log::Dispatch->new( |
|
35
|
|
|
|
|
|
|
outputs => [ |
|
36
|
|
|
|
|
|
|
[ |
|
37
|
|
|
|
|
|
|
$conf{output}, |
|
38
|
|
|
|
|
|
|
min_level => 'warning', |
|
39
|
0
|
0
|
0
|
|
|
|
%{ $conf{args} || {} }, |
|
|
0
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
], |
|
41
|
|
|
|
|
|
|
], |
|
42
|
|
|
|
|
|
|
); |
|
43
|
0
|
|
|
|
|
|
$args{init_args}{_ld}->warning($msg); |
|
44
|
0
|
|
|
|
|
|
}; |
|
45
|
0
|
|
|
|
|
|
[$logger]; |
|
46
|
0
|
|
|
|
|
|
}], |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
|
51
|
|
|
|
|
|
|
# ABSTRACT: Send logs to a Log::Dispatch output |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=encoding UTF-8 |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Log::ger::Output::LogDispatchOutput - Send logs to a Log::Dispatch output |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This document describes version 0.002 of Log::ger::Output::LogDispatchOutput (from Perl distribution Log-ger-Output-LogDispatchOutput), released on 2017-08-03. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
use Log::ger::Output LogDispatchOutput => ( |
|
70
|
|
|
|
|
|
|
output => 'Screen', # choose Log::Dispatch::Screen |
|
71
|
|
|
|
|
|
|
args => {stderr=>1, newline=>1}, |
|
72
|
|
|
|
|
|
|
); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This output sends logs to a Log::Dispatch output. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=for Pod::Coverage ^(.+)$ |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 CONFIGURATION |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 output |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 args |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Log-ger-Output-LogDispatchOutput>. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SOURCE |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Log-ger-Output-LogDispatchOutput>. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 BUGS |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Log-ger-Output-LogDispatchOutput> |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
99
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
100
|
|
|
|
|
|
|
feature. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
L<Log::ger::Output::LogDispatch> |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L<Log::ger> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
L<Log::Dispatch> |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This software is copyright (c) 2017 by perlancar@cpan.org. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
119
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |