1Log::Message::Handlers(U3s)er Contributed Perl DocumentatLioogn::Message::Handlers(3)
2
3
4

NAME

6       Log::Message::Handlers
7

SYNOPSIS

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

DESCRIPTION

21       Log::Message::Handlers provides handlers for Log::Message::Item
22       objects.  The handler corresponding to the level (see Log::Mes‐
23       sage::Item manpage for an explenation about levels) will be called
24       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

Default Handlers

31       log
32
33       Will simply log the error on the stack, and do nothing special
34
35       carp
36
37       Will carp (see the Carp manpage) with the error, and add the timestamp
38       of when it occurred.
39
40       croak
41
42       Will croak (see the Carp manpage) with the error, and add the timestamp
43       of when it occurred.
44
45       cluck
46
47       Will cluck (see the Carp manpage) with the error, and add the timestamp
48       of when it occurred.
49
50       confess
51
52       Will confess (see the Carp manpage) with the error, and add the time‐
53       stamp of when it occurred
54
55       die
56
57       Will simply die with the error message of the item
58
59       warn
60
61       Will simply warn with the error message of the item
62
63       trace
64
65       Will provide a traceback of this error item back to the first one that
66       occurrent, clucking with every item as it comes across it.
67

Custom Handlers

69       If you wish to provide your own handlers, you can simply do the follow‐
70       ing:
71
72       ·   Create a file that holds a package by the name of "Log::Mes‐
73           sage::Handlers"
74
75       ·   Create subroutines with the same name as the levels you wish to
76           handle in the Log::Message module (see the Log::Message manpage for
77           explenation on levels)
78
79       ·   Require that file in your program, or add it in your configuration
80           (see the Log::Message::Config manpage for explenation on how to use
81           a config file)
82
83       And that is it, the handler will now be available to handle messages
84       for you.
85
86       The arguments a handler may receive are those specified by the "extra"
87       key, when storing the message.  See the Log::Message manpage for
88       details on the arguments.
89

SEE ALSO

91       Log::Message, Log::Message::Item, Log::Message::Config
92

AUTHOR

94       This module by Jos Boumans <kane@cpan.org>.
95

Acknowledgements

97       Thanks to Ann Barcomb for her suggestions.
98
100       This module is copyright (c) 2002 Jos Boumans <kane@cpan.org>.  All
101       rights reserved.
102
103       This library is free software; you may redistribute and/or modify it
104       under the same terms as Perl itself.
105
106
107
108perl v5.8.8                       2003-05-07         Log::Message::Handlers(3)
Impressum