annotate Doc/lib/libsyslog.tex @ 25838:8540887bcec6 2.2

Backport of 2.183: Fix memory leak in add_subclass() found by NealN with valgrind.
author Guido van Rossum <guido@python.org>
date Fri, 18 Oct 2002 13:42:21 +0000
parents 6dc36078f53e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
1 \section{\module{syslog} ---
10334
61224459bb09 Added \platform annotations.
Fred Drake <fdrake@acm.org>
parents: 10243
diff changeset
2 \UNIX{} syslog library routines}
61224459bb09 Added \platform annotations.
Fred Drake <fdrake@acm.org>
parents: 10243
diff changeset
3
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8198
diff changeset
4 \declaremodule{builtin}{syslog}
10335
093fc298afd6 "\platform{UNIX}" should really be spelled "\platform{Unix}".
Fred Drake <fdrake@acm.org>
parents: 10334
diff changeset
5 \platform{Unix}
17724
6dc36078f53e Work around limitations of the module synopsis table generation to avoid
Fred Drake <fdrake@acm.org>
parents: 10335
diff changeset
6 \modulesynopsis{An interface to the \UNIX\ syslog library routines.}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8198
diff changeset
7
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
7094
e5548096b42a Consistency: "Unix" ==> "\UNIX{}"
Fred Drake <fdrake@acm.org>
parents: 6687
diff changeset
9 This module provides an interface to the \UNIX{} \code{syslog} library
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 routines. Refer to the \UNIX{} manual pages for a detailed description
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 of the \code{syslog} facility.
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 The module defines the following functions:
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
14
6687
a593c220edcc Added \indexsubitem definition; functions were previously indexed for the
Fred Drake <fdrake@acm.org>
parents: 5818
diff changeset
15
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7277
diff changeset
16 \begin{funcdesc}{syslog}{\optional{priority,} message}
8198
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
17 Send the string \var{message} to the system logger. A trailing
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
18 newline is added if necessary. Each message is tagged with a priority
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
19 composed of a \var{facility} and a \var{level}. The optional
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
20 \var{priority} argument, which defaults to \constant{LOG_INFO},
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
21 determines the message priority. If the facility is not encoded in
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
22 \var{priority} using logical-or (\code{LOG_INFO | LOG_USER}), the
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
23 value given in the \function{openlog()} call is used.
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 \end{funcdesc}
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
25
7094
e5548096b42a Consistency: "Unix" ==> "\UNIX{}"
Fred Drake <fdrake@acm.org>
parents: 6687
diff changeset
26 \begin{funcdesc}{openlog}{ident\optional{, logopt\optional{, facility}}}
8198
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
27 Logging options other than the defaults can be set by explicitly
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
28 opening the log file with \function{openlog()} prior to calling
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
29 \function{syslog()}. The defaults are (usually) \var{ident} =
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
30 \code{'syslog'}, \var{logopt} = \code{0}, \var{facility} =
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
31 \constant{LOG_USER}. The \var{ident} argument is a string which is
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
32 prepended to every message. The optional \var{logopt} argument is a
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
33 bit field - see below for possible values to combine. The optional
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
34 \var{facility} argument sets the default facility for messages which
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
35 do not have a facility explicitly encoded.
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 \end{funcdesc}
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
37
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 \begin{funcdesc}{closelog}{}
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 Close the log file.
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 \end{funcdesc}
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
41
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 \begin{funcdesc}{setlogmask}{maskpri}
10243
575c4ea2542b Fix an amazing number of typos & malformed sentences reported by Detlef
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
43 Set the priority mask to \var{maskpri} and return the
8198
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
44 previous mask value. Calls to \function{syslog()} with a priority
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
45 level not set in \var{maskpri} are ignored. The default is to log all
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
46 priorities. The function \code{LOG_MASK(\var{pri})} calculates the
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
47 mask for the individual priority \var{pri}. The function
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
48 \code{LOG_UPTO(\var{pri})} calculates the mask for all priorities up
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
49 to and including \var{pri}.
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 \end{funcdesc}
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
51
10243
575c4ea2542b Fix an amazing number of typos & malformed sentences reported by Detlef
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
52
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 The module defines the following constants:
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
54
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 \begin{description}
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
56
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 \item[Priority levels (high to low):]
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
58
8198
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
59 \constant{LOG_EMERG}, \constant{LOG_ALERT}, \constant{LOG_CRIT},
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
60 \constant{LOG_ERR}, \constant{LOG_WARNING}, \constant{LOG_NOTICE},
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
61 \constant{LOG_INFO}, \constant{LOG_DEBUG}.
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
62
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 \item[Facilities:]
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
64
8198
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
65 \constant{LOG_KERN}, \constant{LOG_USER}, \constant{LOG_MAIL},
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
66 \constant{LOG_DAEMON}, \constant{LOG_AUTH}, \constant{LOG_LPR},
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
67 \constant{LOG_NEWS}, \constant{LOG_UUCP}, \constant{LOG_CRON} and
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
68 \constant{LOG_LOCAL0} to \constant{LOG_LOCAL7}.
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
69
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
70 \item[Log options:]
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
71
8198
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
72 \constant{LOG_PID}, \constant{LOG_CONS}, \constant{LOG_NDELAY},
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
73 \constant{LOG_NOWAIT} and \constant{LOG_PERROR} if defined in
83a69305cb06 Fix documentation based on comments from Sean Reifschneider
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
74 \code{<syslog.h>}.
3175
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
75
49b787b9bfae syslog docs by steve clift
Guido van Rossum <guido@python.org>
parents:
diff changeset
76 \end{description}