Use py_resource module
[python/dscho.git] / Doc / lib / libsyslog.tex
blob5b4fdded4bca8b1e2c3057ab5d935ef04a2c72e4
1 \section{Built-in Module \sectcode{syslog}}
2 \bimodindex{syslog}
4 This module provides an interface to the Unix \code{syslog} library
5 routines. Refer to the \UNIX{} manual pages for a detailed description
6 of the \code{syslog} facility.
8 The module defines the following functions:
10 \begin{funcdesc}{syslog}{\optional{priority\,} message}
11 Send the string \var{message} to the system logger.
12 A trailing newline is added if necessary.
13 Each message is tagged with a priority composed of a \var{facility} and
14 a \var{level}.
15 The optional \var{priority} argument, which defaults to
16 \code{(LOG_USER | LOG_INFO)}, determines the message priority.
17 \end{funcdesc}
19 \begin{funcdesc}{openlog}{ident\, \optional{logopt\, \optional{facility}}}
20 Logging options other than the defaults can be set by explicitly opening
21 the log file with \code{openlog()} prior to calling \code{syslog()}.
22 The defaults are (usually) \var{ident} = \samp{syslog}, \var{logopt} = 0,
23 \var{facility} = \code{LOG_USER}.
24 The \var{ident} argument is a string which is prepended to every message.
25 The optional \var{logopt} argument is a bit field - see below for possible
26 values to combine.
27 The optional \var{facility} argument sets the default facility for messages
28 which do not have a facility explicitly encoded.
29 \end{funcdesc}
31 \begin{funcdesc}{closelog}{}
32 Close the log file.
33 \end{funcdesc}
35 \begin{funcdesc}{setlogmask}{maskpri}
36 This function set the priority mask to \var{maskpri} and returns the
37 previous mask value.
38 Calls to \code{syslog} with a priority level not set in \var{maskpri}
39 are ignored.
40 The default is to log all priorities.
41 The function \code{LOG_MASK(\var{pri})} calculates the mask for the
42 individual priority \var{pri}.
43 The function \code{LOG_UPTO(\var{pri})} calculates the mask for all priorities
44 up to and including \var{pri}.
45 \end{funcdesc}
47 The module defines the following constants:
49 \begin{description}
51 \item[Priority levels (high to low):]
53 \code{LOG_EMERG}, \code{LOG_ALERT}, \code{LOG_CRIT}, \code{LOG_ERR},
54 \code{LOG_WARNING}, \code{LOG_NOTICE}, \code{LOG_INFO}, \code{LOG_DEBUG}.
56 \item[Facilities:]
58 \code{LOG_KERN}, \code{LOG_USER}, \code{LOG_MAIL}, \code{LOG_DAEMON},
59 \code{LOG_AUTH}, \code{LOG_LPR}, \code{LOG_NEWS}, \code{LOG_UUCP},
60 \code{LOG_CRON} and \code{LOG_LOCAL0} to \code{LOG_LOCAL7}.
62 \item[Log options:]
64 \code{LOG_PID}, \code{LOG_CONS}, \code{LOG_NDELAY}, \code{LOG_NOWAIT}
65 and \code{LOG_PERROR} if defined in \file{syslog.h}.
67 \end{description}