1Log::Message::Simple(3)User Contributed Perl DocumentatioLnog::Message::Simple(3)
2
3
4

NAME

6       Log::Message::Simple
7

SYNOPSIS

9           use Log::Message::Simple qw[msg error debug
10                                       carp croak cluck confess];
11
12           use Log::Message::Simple qw[:STD :CARP];
13
14           ### standard reporting functionality
15           msg(    "Connecting to database",           $verbose );
16           error(  "Database connection failed: $@",   $verbose );
17           debug(  "Connection arguments were: $args", $debug );
18
19           ### standard carp functionality
20           carp(   "Wrong arguments passed: @_" );
21           croak(  "Fatal: wrong arguments passed: @_" );
22           cluck(  "Wrong arguments passed -- including stacktrace: @_" );
23           confess("Fatal: wrong arguments passed -- including stacktrace: @_" );
24
25           ### retrieve individual message
26           my @stack = Log::Message::Simple->stack;
27           my @stack = Log::Message::Simple->flush;
28
29           ### retrieve the entire stack in printable form
30           my $msgs  = Log::Message::Simple->stack_as_string;
31           my $trace = Log::Message::Simple->stack_as_string(1);
32
33           ### redirect output
34           local $Log::Message::Simple::MSG_FH     = \*STDERR;
35           local $Log::Message::Simple::ERROR_FH   = \*STDERR;
36           local $Log::Message::Simple::DEBUG_FH   = \*STDERR;
37
38           ### force a stacktrace on error
39           local $Log::Message::Simple::STACKTRACE_ON_ERROR = 1
40

DESCRIPTION

42       This module provides standardized logging facilities using the
43       "Log::Message" module.
44

FUNCTIONS

46       msg("message string" [,VERBOSE])
47
48       Records a message on the stack, and prints it to "STDOUT" (or actually
49       $MSG_FH, see the "GLOBAL VARIABLES" section below), if the "VERBOSE"
50       option is true.  The "VERBOSE" option defaults to false.
51
52       Exported by default, or using the ":STD" tag.
53
54       debug("message string" [,VERBOSE])
55
56       Records a debug message on the stack, and prints it to "STDOUT" (or
57       actually $DEBUG_FH, see the "GLOBAL VARIABLES" section below), if the
58       "VERBOSE" option is true.  The "VERBOSE" option defaults to false.
59
60       Exported by default, or using the ":STD" tag.
61
62       error("error string" [,VERBOSE])
63
64       Records an error on the stack, and prints it to "STDERR" (or actually
65       $ERROR_FH, see the "GLOBAL VARIABLES" sections below), if the "VERBOSE"
66       option is true.  The "VERBOSE" options defaults to true.
67
68       Exported by default, or using the ":STD" tag.
69
70       carp();
71
72       Provides functionality equal to "Carp::carp()", whilst still logging to
73       the stack.
74
75       Exported by by using the ":CARP" tag.
76
77       croak();
78
79       Provides functionality equal to "Carp::croak()", whilst still logging
80       to the stack.
81
82       Exported by by using the ":CARP" tag.
83
84       confess();
85
86       Provides functionality equal to "Carp::confess()", whilst still logging
87       to the stack.
88
89       Exported by by using the ":CARP" tag.
90
91       cluck();
92
93       Provides functionality equal to "Carp::cluck()", whilst still logging
94       to the stack.
95
96       Exported by by using the ":CARP" tag.
97

CLASS METHODS

99       Log::Message::Simple->stack()
100
101       Retrieves all the items on the stack. Since "Log::Message::Simple" is
102       implemented using "Log::Message", consult its manpage for the function
103       "retrieve" to see what is returned and how to use the items.
104
105       Log::Message::Simple->stack_as_string([TRACE])
106
107       Returns the whole stack as a printable string. If the "TRACE" option is
108       true all items are returned with "Carp::longmess" output, rather than
109       just the message.  "TRACE" defaults to false.
110
111       Log::Message::Simple->flush()
112
113       Removes all the items from the stack and returns them. Since "Log::Mes‐
114       sage::Simple" is  implemented using "Log::Message", consult its manpage
115       for the function "retrieve" to see what is returned and how to use the
116       items.
117

GLOBAL VARIABLES

119       $ERROR_FH
120           This is the filehandle all the messages sent to "error()" are being
121           printed. This defaults to *STDERR.
122
123       $MSG_FH
124           This is the filehandle all the messages sent to "msg()" are being
125           printed. This default to *STDOUT.
126
127       $DEBUG_FH
128           This is the filehandle all the messages sent to "debug()" are being
129           printed. This default to *STDOUT.
130
131       $STACKTRACE_ON_ERROR
132           If this option is set to "true", every call to "error()" will gen‐
133           erate a stacktrace using "Carp::shortmess()".  Defaults to "false"
134
135
136
137perl v5.8.8                       2005-07-01           Log::Message::Simple(3)
Impressum