1Log::Message::Handlers(U3s)er Contributed Perl DocumentatLioogn::Message::Handlers(3)
2
3
4
6 Log::Message::Handlers - Message handlers for Log::Message
7
9 # Implicitly used by Log::Message to serve as handlers for
10 # Log::Message::Item objects
11
12 # Create your own file with a package called
13 # Log::Message::Handlers to add to the existing ones, or to even
14 # overwrite them
15
16 $item->carp;
17
18 $item->trace;
19
21 Log::Message::Handlers provides handlers for Log::Message::Item
22 objects. The handler corresponding to the level (see
23 Log::Message::Item manpage for an explanation about levels) will be
24 called automatically upon storing the error.
25
26 Handlers may also explicitly be called on an Log::Message::Item object
27 if one so desires (see the Log::Message manpage on how to retrieve the
28 Item objects).
29
31 log
32 Will simply log the error on the stack, and do nothing special
33
34 carp
35 Will carp (see the Carp manpage) with the error, and add the timestamp
36 of when it occurred.
37
38 croak
39 Will croak (see the Carp manpage) with the error, and add the timestamp
40 of when it occurred.
41
42 cluck
43 Will cluck (see the Carp manpage) with the error, and add the timestamp
44 of when it occurred.
45
46 confess
47 Will confess (see the Carp manpage) with the error, and add the
48 timestamp of when it occurred
49
50 die
51 Will simply die with the error message of the item
52
53 warn
54 Will simply warn with the error message of the item
55
56 trace
57 Will provide a traceback of this error item back to the first one that
58 occurred, clucking with every item as it comes across it.
59
61 If you wish to provide your own handlers, you can simply do the
62 following:
63
64 · Create a file that holds a package by the name of
65 "Log::Message::Handlers"
66
67 · Create subroutines with the same name as the levels you wish to
68 handle in the Log::Message module (see the Log::Message manpage for
69 explanation on levels)
70
71 · Require that file in your program, or add it in your configuration
72 (see the Log::Message::Config manpage for explanation on how to use
73 a config file)
74
75 And that is it, the handler will now be available to handle messages
76 for you.
77
78 The arguments a handler may receive are those specified by the "extra"
79 key, when storing the message. See the Log::Message manpage for
80 details on the arguments.
81
83 Log::Message, Log::Message::Item, Log::Message::Config
84
86 This module by Jos Boumans <kane@cpan.org>.
87
89 Thanks to Ann Barcomb for her suggestions.
90
92 This module is copyright (c) 2002 Jos Boumans <kane@cpan.org>. All
93 rights reserved.
94
95 This library is free software; you may redistribute and/or modify it
96 under the same terms as Perl itself.
97
98
99
100perl v5.32.0 2020-07-28 Log::Message::Handlers(3)