1No::Worries::Syslog(3)User Contributed Perl DocumentationNo::Worries::Syslog(3)
2
3
4
6 No::Worries::Syslog - syslog handling without worries
7
9 use No::Worries::Syslog qw(syslog_open syslog_close syslog_info);
10
11 # setup/open syslog
12 syslog_open(ident => "progname", facility => "daemon");
13
14 # report an informational message
15 syslog_info("foo is %s", $foo);
16
17 # close syslog
18 syslog_close();
19
21 This module eases syslog handling by providing convenient wrappers
22 around standard syslog functions.
23
24 The functions provide a thin layer on top of Sys::Syslog to make it
25 easier and safer to use. All the functions die() on error and the
26 strings passed to syslog will always be sanitized.
27
29 This module provides the following functions (none of them being
30 exported by default):
31
32 syslog_open([OPTIONS])
33 open a "connection" to syslog using Sys::Syslog's openlog();
34 supported options
35
36 • "facility": corresponding to openlog()'s eponymous argument
37
38 • "ident": corresponding to openlog()'s eponymous argument
39
40 • "option": corresponding to openlog()'s eponymous argument
41
42 syslog_close()
43 close a "connection" to syslog using Sys::Syslog's closelog()
44
45 syslog_sanitize(STRING)
46 sanitize the given string so that it can safely be given to
47 syslog(): UTF-8 encode wide characters, trim trailing spaces,
48 replace tabs by spaces, URI escape non-printable characters and
49 truncate if too long
50
51 syslog_debug(MESSAGE)
52 report a sanitized debugging message to syslog (with LOG_DEBUG
53 priority and "[DEBUG]" prefix)
54
55 syslog_debug(FORMAT, ARGUMENTS...)
56 idem but with sprintf()-like API
57
58 syslog_info(MESSAGE)
59 report a sanitized informational message to syslog (with LOG_INFO
60 priority and "[INFO]" prefix)
61
62 syslog_info(FORMAT, ARGUMENTS...)
63 idem but with sprintf()-like API
64
65 syslog_warning(MESSAGE)
66 report a sanitized warning message to syslog (with LOG_WARNING
67 priority and "[WARNING]" prefix)
68
69 syslog_warning(FORMAT, ARGUMENTS...)
70 idem but with sprintf()-like API
71
72 syslog_error(MESSAGE)
73 report a sanitized error message to syslog (with LOG_ERR priority
74 and "[ERROR]" prefix)
75
76 syslog_error(FORMAT, ARGUMENTS...)
77 idem but with sprintf()-like API
78
79 log2syslog(INFO)
80 No::Worries::Log handler to send information to syslog; this is not
81 exported and must be called explicitly
82
84 This module uses the following global variables (none of them being
85 exported):
86
87 $MaximumLength
88 maximum length of a message given to syslog (default: 1000)
89
90 $SplitLines
91 true if multi-line messages should be logged as separate syslog
92 messages (default: true)
93
95 No::Worries, No::Worries::Die, No::Worries::Log, No::Worries::Warn,
96 Sys::Syslog, URI::Escape.
97
99 Lionel Cons <http://cern.ch/lionel.cons>
100
101 Copyright (C) CERN 2012-2019
102
103
104
105perl v5.34.0 2022-01-21 No::Worries::Syslog(3)