1Log::Dispatch::Syslog(3U)ser Contributed Perl DocumentatiLoong::Dispatch::Syslog(3)
2
3
4
6 Log::Dispatch::Syslog - Object for logging to system log.
7
9 version 2.70
10
12 use Log::Dispatch;
13
14 my $log = Log::Dispatch->new(
15 outputs => [
16 [
17 'Syslog',
18 min_level => 'info',
19 ident => 'Yadda yadda'
20 ]
21 ]
22 );
23
24 $log->emerg("Time to die.");
25
27 This module provides a simple object for sending messages to the system
28 log (via UNIX syslog calls).
29
30 Note that logging may fail if you try to pass UTF-8 characters in the
31 log message. If logging fails and warnings are enabled, the error
32 message will be output using Perl's "warn".
33
35 The constructor takes the following parameters in addition to the
36 standard parameters documented in Log::Dispatch::Output:
37
38 • ident ($)
39
40 This string will be prepended to all messages in the system log.
41 Defaults to $0.
42
43 • logopt ($)
44
45 A string containing the log options (separated by any separator you
46 like). See the openlog(3) and Sys::Syslog docs for more details.
47 Defaults to ''.
48
49 • facility ($)
50
51 Specifies what type of program is doing the logging to the system
52 log. Valid options are 'auth', 'authpriv', 'cron', 'daemon',
53 'kern', 'local0' through 'local7', 'mail, 'news', 'syslog', 'user',
54 'uucp'. Defaults to 'user'
55
56 • socket ($, \@, or \%)
57
58 Tells what type of socket to use for sending syslog messages. Valid
59 options are listed in "Sys::Syslog".
60
61 If you don't provide this, then we let "Sys::Syslog" simply pick
62 one that works, which is the preferred option, as it makes your
63 code more portable.
64
65 If you pass an array reference, it is dereferenced and passed to
66 Sys::Syslog::setlogsock().
67
68 If you pass a hash reference, it is passed to
69 Sys::Syslog::setlogsock() as is.
70
71 • lock ($)
72
73 If this is set to a true value, then the calls to setlogsock(),
74 openlog(), syslog(), and closelog() will all be guarded by a
75 thread-locked variable.
76
77 This is only relevant when running you are using Perl threads in
78 your application. Setting this to a true value will cause the
79 threads and threads::shared modules to be loaded.
80
81 This defaults to false.
82
84 Bugs may be submitted at
85 <https://github.com/houseabsolute/Log-Dispatch/issues>.
86
87 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
88
90 The source code repository for Log-Dispatch can be found at
91 <https://github.com/houseabsolute/Log-Dispatch>.
92
94 Dave Rolsky <autarch@urth.org>
95
97 This software is Copyright (c) 2020 by Dave Rolsky.
98
99 This is free software, licensed under:
100
101 The Artistic License 2.0 (GPL Compatible)
102
103 The full text of the license can be found in the LICENSE file included
104 with this distribution.
105
106
107
108perl v5.36.0 2023-01-20 Log::Dispatch::Syslog(3)