1Log::Message::Item(3) User Contributed Perl DocumentationLog::Message::Item(3)
2
3
4
6 Log::Message::Item - Message objects for Log::Message
7
9 # Implicitly used by Log::Message to create Log::Message::Item objects
10
11 print "this is the message's id: ", $item->id;
12
13 print "this is the message stored: ", $item->message;
14
15 print "this is when it happened: ", $item->when;
16
17 print "the message was tagged: ", $item->tag;
18
19 print "this was the severity level: ", $item->level;
20
21 $item->remove; # delete the item from the stack it was on
22
23 # Besides these methods, you can also call the handlers on
24 # the object specifically.
25 # See the Log::Message::Handlers manpage for documentation on what
26 # handlers are available by default and how to add your own
27
29 Log::Message::Item is a class that generates generic Log items. These
30 items are stored on a Log::Message stack, so see the Log::Message
31 manpage about details how to retrieve them.
32
33 You should probably not create new items by yourself, but use the
34 storing mechanism provided by Log::Message.
35
36 However, the accessors and handlers are of interest if you want to do
37 fine tuning of how your messages are handled.
38
39 The accessors and methods are described below, the handlers are
40 documented in the Log::Message::Handlers manpage.
41
43 remove
44 Calling remove will remove the object from the stack it was on, so it
45 will not show up any more in subsequent fetches of messages.
46
47 You can still call accessors and handlers on it however, to handle it
48 as you will.
49
50 id
51 Returns the internal ID of the item. This may be useful for comparing
52 since the ID is incremented each time a new item is created.
53 Therefore, an item with ID 4 must have been logged before an item with
54 ID 9.
55
56 when
57 Returns the timestamp of when the message was logged
58
59 message
60 The actual message that was stored
61
62 level
63 The severity type of this message, as well as the name of the handler
64 that was called upon storing it.
65
66 tag
67 Returns the identification tag that was put on the message.
68
69 shortmess
70 Returns the equivalent of a "Carp::shortmess" for this item. See the
71 "Carp" manpage for details.
72
73 longmess
74 Returns the equivalent of a "Carp::longmess" for this item, which is
75 essentially a stack trace. See the "Carp" manpage for details.
76
77 parent
78 Returns a reference to the Log::Message object that stored this item.
79 This is useful if you want to have access to the full stack in a
80 handler.
81
83 Log::Message, Log::Message::Handlers, 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.38.0 2023-07-20 Log::Message::Item(3)