source: vendor/python/2.5/Doc/lib/libsyslog.tex

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 2.8 KB
Line 
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
9This module provides an interface to the \UNIX{} \code{syslog} library
10routines. Refer to the \UNIX{} manual pages for a detailed description
11of the \code{syslog} facility.
12
13The module defines the following functions:
14
15
16\begin{funcdesc}{syslog}{\optional{priority,} message}
17Send the string \var{message} to the system logger. A trailing
18newline is added if necessary. Each message is tagged with a priority
19composed of a \var{facility} and a \var{level}. The optional
20\var{priority} argument, which defaults to \constant{LOG_INFO},
21determines the message priority. If the facility is not encoded in
22\var{priority} using logical-or (\code{LOG_INFO | LOG_USER}), the
23value given in the \function{openlog()} call is used.
24\end{funcdesc}
25
26\begin{funcdesc}{openlog}{ident\optional{, logopt\optional{, facility}}}
27Logging options other than the defaults can be set by explicitly
28opening 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
32prepended to every message. The optional \var{logopt} argument is a
33bit field - see below for possible values to combine. The optional
34\var{facility} argument sets the default facility for messages which
35do not have a facility explicitly encoded.
36\end{funcdesc}
37
38\begin{funcdesc}{closelog}{}
39Close the log file.
40\end{funcdesc}
41
42\begin{funcdesc}{setlogmask}{maskpri}
43Set the priority mask to \var{maskpri} and return the
44previous mask value. Calls to \function{syslog()} with a priority
45level not set in \var{maskpri} are ignored. The default is to log all
46priorities. The function \code{LOG_MASK(\var{pri})} calculates the
47mask for the individual priority \var{pri}. The function
48\code{LOG_UPTO(\var{pri})} calculates the mask for all priorities up
49to and including \var{pri}.
50\end{funcdesc}
51
52
53The 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}
Note: See TracBrowser for help on using the repository browser.