1Log::Report::DispatcherU:s:eSrysCloongt(r3i)buted Perl DLoocgu:m:eRnetpaotrito:n:Dispatcher::Syslog(3)
2
3
4
6 Log::Report::Dispatcher::Syslog - send messages to syslog
7
9 Log::Report::Dispatcher::Syslog
10 is a Log::Report::Dispatcher
11
13 # add syslog dispatcher
14 dispatcher SYSLOG => 'syslog', accept => 'NOTICE-'
15 , format_reason => 'IGNORE'
16 , to_prio => [ 'ALERT-' => 'err' ];
17
18 # disable default dispatcher, when daemon
19 dispatcher close => 'default';
20
22 This dispatchers produces output to syslog, based on the Sys::Syslog
23 module (which will NOT be automatically installed for you, because some
24 systems have a problem with this dependency).
25
26 The REASON for a message often uses names which are quite similar to
27 the log-levels used by syslog. However: they have a different purpose.
28 The REASON is used by the programmer to indicate the cause of the
29 message: whether it was able to handle a certain situation. The syslog
30 levels are there for the user's of the program (with syslog usually the
31 system administrators). It is not unusual to see a "normal" error or
32 mistake as a very serious situation in a production environment. So,
33 you may wish to translate any message above reason MISTAKE into a
34 LOG_CRIT.
35
36 The default translation table is list below. You can change the
37 mapping using new(to_prio). See example in SYNOPSIS.
38
39 TRACE => LOG_DEBUG ERROR => LOG_ERR
40 ASSERT => LOG_DEBUG FAULT => LOG_ERR
41 INFO => LOG_INFO ALERT => LOG_ALERT
42 NOTICE => LOG_NOTICE FAILURE => LOG_EMERG
43 WARNING => LOG_WARNING PANIC => LOG_CRIT
44 MISTAKE => LOG_WARNING
45
46 Extends "DESCRIPTION" in Log::Report::Dispatcher.
47
49 Extends "METHODS" in Log::Report::Dispatcher.
50
51 Constructors
52 Extends "Constructors" in Log::Report::Dispatcher.
53
54 $obj->close()
55 Inherited, see "Constructors" in Log::Report::Dispatcher
56
57 Log::Report::Dispatcher::Syslog->new($type, $name, %options)
58 With syslog, people tend not to include the REASON of the message
59 in the logs, because that is already used to determine the
60 destination of the message.
61
62 -Option --Defined in --Default
63 accept Log::Report::Dispatcher depend on mode
64 charset 'utf8'
65 facility 'user'
66 flags 'pid,nowait'
67 format <unchanged>
68 format_reason Log::Report::Dispatcher 'IGNORE'
69 identity <basename $0>
70 include_domain <false>
71 locale Log::Report::Dispatcher <system locale>
72 logsocket undef
73 mode Log::Report::Dispatcher 'NORMAL'
74 to_prio []
75
76 accept => REASONS
77 charset => CHARSET
78 Translate the text-strings into the specified charset, otherwise
79 the sysadmin may get unreadable text.
80
81 facility => STRING
82 The possible values for this depend (a little) on the system.
83 POSIX only defines "user", and "local0" up to "local7".
84
85 flags => STRING
86 Any combination of flags as defined by Sys::Syslog, for instance
87 "pid", "ndelay", and "nowait".
88
89 format => CODE
90 [1.10] With a CODE reference you get your hands on the text
91 before it gets sent to syslog. The three parameters are: the
92 (translated) text, the related text domain object, and the
93 message object. You may want to use context information from the
94 latter.
95
96 [1.19] After the three positional parameters, there may be a list
97 of pairs (named parameters) with additional info. This may
98 contain a "location" with an ARRAY of information produced by
99 caller() about the origin of the exception.
100
101 format_reason => 'UPPERCASE'|'LOWERCASE'|'UCFIRST'|'IGNORE'|CODE
102 identity => STRING
103 include_domain => BOOLEAN
104 [1.00] Include the text-domain of the message in each logged
105 message.
106
107 locale => LOCALE
108 logsocket => 'unix'|'inet'|'stream'|HASH
109 If specified, the log socket type will be initialized to this
110 before "openlog()" is called. If not specified, the system
111 default is used.
112
113 mode => 'NORMAL'|'VERBOSE'|'ASSERT'|'DEBUG'|0..3
114 to_prio => ARRAY-of-PAIRS
115 See reasonToPrio().
116
117 Accessors
118 Extends "Accessors" in Log::Report::Dispatcher.
119
120 $obj->format( [CODE] )
121 Returns the CODE ref which formats the syslog line.
122
123 $obj->isDisabled()
124 Inherited, see "Accessors" in Log::Report::Dispatcher
125
126 $obj->mode()
127 Inherited, see "Accessors" in Log::Report::Dispatcher
128
129 $obj->name()
130 Inherited, see "Accessors" in Log::Report::Dispatcher
131
132 $obj->needs( [$reason] )
133 Inherited, see "Accessors" in Log::Report::Dispatcher
134
135 $obj->type()
136 Inherited, see "Accessors" in Log::Report::Dispatcher
137
138 Logging
139 Extends "Logging" in Log::Report::Dispatcher.
140
141 $obj->addSkipStack(@CODE)
142 Log::Report::Dispatcher::Syslog->addSkipStack(@CODE)
143 Inherited, see "Logging" in Log::Report::Dispatcher
144
145 $obj->collectLocation()
146 Log::Report::Dispatcher::Syslog->collectLocation()
147 Inherited, see "Logging" in Log::Report::Dispatcher
148
149 $obj->collectStack( [$maxdepth] )
150 Log::Report::Dispatcher::Syslog->collectStack( [$maxdepth] )
151 Inherited, see "Logging" in Log::Report::Dispatcher
152
153 $obj->log(HASH-$of-%options, $reason, $message, $domain)
154 Inherited, see "Logging" in Log::Report::Dispatcher
155
156 $obj->reasonToPrio($reason)
157 Returns a level which is understood by syslog(3), based on a
158 translation table. This can be changed with new(to_prio).
159
160 $obj->skipStack()
161 Inherited, see "Logging" in Log::Report::Dispatcher
162
163 $obj->stackTraceLine(%options)
164 Log::Report::Dispatcher::Syslog->stackTraceLine(%options)
165 Inherited, see "Logging" in Log::Report::Dispatcher
166
167 $obj->translate(HASH-$of-%options, $reason, $message)
168 Inherited, see "Logging" in Log::Report::Dispatcher
169
171 Extends "DETAILS" in Log::Report::Dispatcher.
172
174 This module is part of Log-Report distribution version 1.32, built on
175 January 26, 2021. Website: http://perl.overmeer.net/CPAN/
176
178 Copyrights 2007-2021 by [Mark Overmeer <markov@cpan.org>]. For other
179 contributors see ChangeLog.
180
181 This program is free software; you can redistribute it and/or modify it
182 under the same terms as Perl itself. See http://dev.perl.org/licenses/
183
184
185
186perl v5.32.1 2021-01-26Log::Report::Dispatcher::Syslog(3)