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.71
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
60 The source code repository for Log-Dispatch can be found at
61 <https://github.com/houseabsolute/Log-Dispatch>.
62
64 Dave Rolsky <autarch@urth.org>
65
67 This software is Copyright (c) 2023 by Dave Rolsky.
68
69 This is free software, licensed under:
70
71 The Artistic License 2.0 (GPL Compatible)
72
73 The full text of the license can be found in the LICENSE file included
74 with this distribution.
75
76
77
78perl v5.38.0 2023-07-20 Log::Dispatch::Code(3)