1 | \section{\module{syslog} ---
|
---|
2 | \UNIX{} syslog library routines}
|
---|
3 |
|
---|
4 | \declaremodule{builtin}{syslog}
|
---|
5 | \platform{Unix}
|
---|
6 | \modulesynopsis{An interface to the \UNIX\ syslog library routines.}
|
---|
7 |
|
---|
8 |
|
---|
9 | This module provides an interface to the \UNIX{} \code{syslog} library
|
---|
10 | routines. Refer to the \UNIX{} manual pages for a detailed description
|
---|
11 | of the \code{syslog} facility.
|
---|
12 |
|
---|
13 | The module defines the following functions:
|
---|
14 |
|
---|
15 |
|
---|
16 | \begin{funcdesc}{syslog}{\optional{priority,} message}
|
---|
17 | Send the string \var{message} to the system logger. A trailing
|
---|
18 | newline is added if necessary. Each message is tagged with a priority
|
---|
19 | composed of a \var{facility} and a \var{level}. The optional
|
---|
20 | \var{priority} argument, which defaults to \constant{LOG_INFO},
|
---|
21 | determines the message priority. If the facility is not encoded in
|
---|
22 | \var{priority} using logical-or (\code{LOG_INFO | LOG_USER}), the
|
---|
23 | value given in the \function{openlog()} call is used.
|
---|
24 | \end{funcdesc}
|
---|
25 |
|
---|
26 | \begin{funcdesc}{openlog}{ident\optional{, logopt\optional{, facility}}}
|
---|
27 | Logging options other than the defaults can be set by explicitly
|
---|
28 | opening the log file with \function{openlog()} prior to calling
|
---|
29 | \function{syslog()}. The defaults are (usually) \var{ident} =
|
---|
30 | \code{'syslog'}, \var{logopt} = \code{0}, \var{facility} =
|
---|
31 | \constant{LOG_USER}. The \var{ident} argument is a string which is
|
---|
32 | prepended to every message. The optional \var{logopt} argument is a
|
---|
33 | bit field - see below for possible values to combine. The optional
|
---|
34 | \var{facility} argument sets the default facility for messages which
|
---|
35 | do not have a facility explicitly encoded.
|
---|
36 | \end{funcdesc}
|
---|
37 |
|
---|
38 | \begin{funcdesc}{closelog}{}
|
---|
39 | Close the log file.
|
---|
40 | \end{funcdesc}
|
---|
41 |
|
---|
42 | \begin{funcdesc}{setlogmask}{maskpri}
|
---|
43 | Set the priority mask to \var{maskpri} and return the
|
---|
44 | previous mask value. Calls to \function{syslog()} with a priority
|
---|
45 | level not set in \var{maskpri} are ignored. The default is to log all
|
---|
46 | priorities. The function \code{LOG_MASK(\var{pri})} calculates the
|
---|
47 | mask for the individual priority \var{pri}. The function
|
---|
48 | \code{LOG_UPTO(\var{pri})} calculates the mask for all priorities up
|
---|
49 | to and including \var{pri}.
|
---|
50 | \end{funcdesc}
|
---|
51 |
|
---|
52 |
|
---|
53 | The module defines the following constants:
|
---|
54 |
|
---|
55 | \begin{description}
|
---|
56 |
|
---|
57 | \item[Priority levels (high to low):]
|
---|
58 |
|
---|
59 | \constant{LOG_EMERG}, \constant{LOG_ALERT}, \constant{LOG_CRIT},
|
---|
60 | \constant{LOG_ERR}, \constant{LOG_WARNING}, \constant{LOG_NOTICE},
|
---|
61 | \constant{LOG_INFO}, \constant{LOG_DEBUG}.
|
---|
62 |
|
---|
63 | \item[Facilities:]
|
---|
64 |
|
---|
65 | \constant{LOG_KERN}, \constant{LOG_USER}, \constant{LOG_MAIL},
|
---|
66 | \constant{LOG_DAEMON}, \constant{LOG_AUTH}, \constant{LOG_LPR},
|
---|
67 | \constant{LOG_NEWS}, \constant{LOG_UUCP}, \constant{LOG_CRON} and
|
---|
68 | \constant{LOG_LOCAL0} to \constant{LOG_LOCAL7}.
|
---|
69 |
|
---|
70 | \item[Log options:]
|
---|
71 |
|
---|
72 | \constant{LOG_PID}, \constant{LOG_CONS}, \constant{LOG_NDELAY},
|
---|
73 | \constant{LOG_NOWAIT} and \constant{LOG_PERROR} if defined in
|
---|
74 | \code{<syslog.h>}.
|
---|
75 |
|
---|
76 | \end{description}
|
---|