1Log::Dispatch::Code(3)User Contributed Perl DocumentationLog::Dispatch::Code(3)
2
3
4
6 Log::Dispatch::Code - Object for logging to a subroutine reference
7
9 version 2.70
10
12 use Log::Dispatch;
13
14 my $log = Log::Dispatch->new(
15 outputs => [
16 [
17 'Code',
18 min_level => 'emerg',
19 code => \&_log_it,
20 ],
21 ]
22 );
23
24 sub _log_it {
25 my %p = @_;
26
27 warn $p{message};
28 }
29
31 This module supplies a simple object for logging to a subroutine
32 reference.
33
35 The constructor takes the following parameters in addition to the
36 standard parameters documented in Log::Dispatch::Output:
37
38 · code ($)
39
40 The subroutine reference.
41
43 The subroutine you provide will be called with a hash of named
44 arguments. The two arguments are:
45
46 · level
47
48 The log level of the message. This will be a string like "info" or
49 "error".
50
51 · message
52
53 The message being logged.
54
56 Bugs may be submitted at
57 <https://github.com/houseabsolute/Log-Dispatch/issues>.
58
59 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
60
62 The source code repository for Log-Dispatch can be found at
63 <https://github.com/houseabsolute/Log-Dispatch>.
64
66 Dave Rolsky <autarch@urth.org>
67
69 This software is Copyright (c) 2020 by Dave Rolsky.
70
71 This is free software, licensed under:
72
73 The Artistic License 2.0 (GPL Compatible)
74
75 The full text of the license can be found in the LICENSE file included
76 with this distribution.
77
78
79
80perl v5.32.0 2020-07-31 Log::Dispatch::Code(3)