summaryrefslogtreecommitdiffstats
path: root/Doc/library/syslog.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-05-19 20:57:08 (GMT)
committerGeorg Brandl <georg@python.org>2010-05-19 20:57:08 (GMT)
commit8569e582f85e8a44bf34238f6a1809eb6e001de9 (patch)
tree330faf435a111cf1229b9c87f014873da7ba25ae /Doc/library/syslog.rst
parent7d79b8b7714b5e7d8a0582a07b5625c280c879c0 (diff)
downloadcpython-8569e582f85e8a44bf34238f6a1809eb6e001de9.zip
cpython-8569e582f85e8a44bf34238f6a1809eb6e001de9.tar.gz
cpython-8569e582f85e8a44bf34238f6a1809eb6e001de9.tar.bz2
Merged revisions 80030,80067,80069,80080-80081,80084,80432-80433,80465-80470,81059,81065-81067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80030 | georg.brandl | 2010-04-13 08:43:54 +0200 (Di, 13 Apr 2010) | 1 line Get rid of multi-row cells. ........ r80067 | georg.brandl | 2010-04-14 10:53:38 +0200 (Mi, 14 Apr 2010) | 1 line #5341: typo. ........ r80069 | georg.brandl | 2010-04-14 15:50:31 +0200 (Mi, 14 Apr 2010) | 1 line Add an x-ref to where the O_ constants are documented and move the SEEK_ constants after lseek(). ........ r80080 | georg.brandl | 2010-04-14 21:16:38 +0200 (Mi, 14 Apr 2010) | 1 line #8399: add note about Windows and O_BINARY. ........ r80081 | georg.brandl | 2010-04-14 23:34:44 +0200 (Mi, 14 Apr 2010) | 1 line #5250: document __instancecheck__ and __subclasscheck__. I hope the part about the class/metaclass distinction is understandable. ........ r80084 | georg.brandl | 2010-04-14 23:46:45 +0200 (Mi, 14 Apr 2010) | 1 line Fix missing. ........ r80432 | georg.brandl | 2010-04-24 10:56:58 +0200 (Sa, 24 Apr 2010) | 1 line Markup fixes. ........ r80433 | georg.brandl | 2010-04-24 11:08:10 +0200 (Sa, 24 Apr 2010) | 1 line #7507: quote "!" in pipes.quote(); it is a special character for some shells. ........ r80465 | georg.brandl | 2010-04-25 12:29:17 +0200 (So, 25 Apr 2010) | 1 line Remove LaTeXy index entry syntax. ........ r80466 | georg.brandl | 2010-04-25 12:54:42 +0200 (So, 25 Apr 2010) | 1 line Patch from Tim Hatch: Better cross-referencing in socket and winreg docs. ........ r80467 | georg.brandl | 2010-04-25 12:55:16 +0200 (So, 25 Apr 2010) | 1 line Patch from Tim Hatch: Remove reference to winreg being the fabled high-level registry interface. ........ r80468 | georg.brandl | 2010-04-25 12:55:58 +0200 (So, 25 Apr 2010) | 1 line Patch from Tim Hatch: Minor spelling changes to _winreg docs. ........ r80469 | georg.brandl | 2010-04-25 12:56:41 +0200 (So, 25 Apr 2010) | 1 line Fix code example to have valid syntax so that it can be highlighted. ........ r80470 | georg.brandl | 2010-04-25 12:57:15 +0200 (So, 25 Apr 2010) | 1 line Patch from Tim Hatch: Make socket setblocking <-> settimeout examples symmetric. ........ r81059 | georg.brandl | 2010-05-10 23:02:51 +0200 (Mo, 10 Mai 2010) | 1 line #8642: fix wrong function name. ........ r81065 | georg.brandl | 2010-05-10 23:46:50 +0200 (Mo, 10 Mai 2010) | 1 line Fix reference direction. ........ r81066 | georg.brandl | 2010-05-10 23:50:57 +0200 (Mo, 10 Mai 2010) | 1 line Consolidate deprecation messages. ........ r81067 | georg.brandl | 2010-05-10 23:51:33 +0200 (Mo, 10 Mai 2010) | 1 line Fix typo. ........
Diffstat (limited to 'Doc/library/syslog.rst')
-rw-r--r--Doc/library/syslog.rst81
1 files changed, 39 insertions, 42 deletions
diff --git a/Doc/library/syslog.rst b/Doc/library/syslog.rst
index c25ed41..a3b374a 100644
--- a/Doc/library/syslog.rst
+++ b/Doc/library/syslog.rst
@@ -10,66 +10,63 @@ This module provides an interface to the Unix ``syslog`` library routines.
Refer to the Unix manual pages for a detailed description of the ``syslog``
facility.
-This module wraps the system ``syslog`` module. A pure Python
-library that can speak to a syslog server is available in
-the :mod:`logging.handlers` module as :class:`SysLogHandler`.
+This module wraps the system ``syslog`` family of routines. A pure Python
+library that can speak to a syslog server is available in the
+:mod:`logging.handlers` module as :class:`SysLogHandler`.
The module defines the following functions:
.. function:: syslog([priority,] message)
- Send the string *message* to the system logger. A trailing newline is
- added if necessary. Each message is tagged with a priority composed
- of a *facility* and a *level*. The optional *priority* argument, which
- defaults to :const:`LOG_INFO`, determines the message priority. If the
- facility is not encoded in *priority* using logical-or (``LOG_INFO |
- LOG_USER``), the value given in the :func:`openlog` call is used.
+ Send the string *message* to the system logger. A trailing newline is added
+ if necessary. Each message is tagged with a priority composed of a
+ *facility* and a *level*. The optional *priority* argument, which defaults
+ to :const:`LOG_INFO`, determines the message priority. If the facility is
+ not encoded in *priority* using logical-or (``LOG_INFO | LOG_USER``), the
+ value given in the :func:`openlog` call is used.
- If :func:`openlog` has not been called prior to the call to
- :func:'syslog', ``openlog()`` will be called with no arguments.
+ If :func:`openlog` has not been called prior to the call to :func:`syslog`,
+ ``openlog()`` will be called with no arguments.
.. function:: openlog([ident[, logopt[, facility]]])
- Logging options of subsequent :func:`syslog` calls can be set by
- calling :func:`openlog`. :func:`syslog` will call :func:`openlog`
- with no arguments if the log is not currently open.
+ Logging options of subsequent :func:`syslog` calls can be set by calling
+ :func:`openlog`. :func:`syslog` will call :func:`openlog` with no arguments
+ if the log is not currently open.
- The optional *ident* keyword argument is a string which is prepended
- to every message, and defaults to ''sys.argv[0]'' with leading
- path components stripped. The optional *logopt* keyword argument
- (default=0) is a bit field - see below for possible values to combine.
- The optional *facility* keyword argument (default=:const:`LOG_USER`)
- sets the default facility for messages which do not have a facility
- explicitly encoded.
+ The optional *ident* keyword argument is a string which is prepended to every
+ message, and defaults to ``sys.argv[0]`` with leading path components
+ stripped. The optional *logopt* keyword argument (default is 0) is a bit
+ field -- see below for possible values to combine. The optional *facility*
+ keyword argument (default is :const:`LOG_USER`) sets the default facility for
+ messages which do not have a facility explicitly encoded.
- .. versionchanged::3.2
- In previous versions, keyword arguments were not allowed, and *ident*
- was required. The default for *ident* was dependent on the system
- libraries, and often was ''python'' instead of the name of the
- python program file.
+ .. versionchanged:: 3.2
+ In previous versions, keyword arguments were not allowed, and *ident* was
+ required. The default for *ident* was dependent on the system libraries,
+ and often was ``python`` instead of the name of the python program file.
.. function:: closelog()
- Reset the syslog module values and call the system library
- ''closelog()''.
+ Reset the syslog module values and call the system library ``closelog()``.
- This causes the module to behave as it does when initially imported.
- For example, :func:'openlog' will be called on the first :func:'syslog'
- call (if :func:'openlog' hasn't already been called), and *ident*
- and other :func:'openlog' parameters are reset to defaults.
+ This causes the module to behave as it does when initially imported. For
+ example, :func:`openlog` will be called on the first :func:`syslog` call (if
+ :func:`openlog` hasn't already been called), and *ident* and other
+ :func:`openlog` parameters are reset to defaults.
.. function:: setlogmask(maskpri)
- Set the priority mask to *maskpri* and return the previous mask value.
- Calls to :func:`syslog` with a priority level not set in *maskpri*
- are ignored. The default is to log all priorities. The function
- ``LOG_MASK(pri)`` calculates the mask for the individual priority
- *pri*. The function ``LOG_UPTO(pri)`` calculates the mask for all
- priorities up to and including *pri*.
+ Set the priority mask to *maskpri* and return the previous mask value. Calls
+ to :func:`syslog` with a priority level not set in *maskpri* are ignored.
+ The default is to log all priorities. The function ``LOG_MASK(pri)``
+ calculates the mask for the individual priority *pri*. The function
+ ``LOG_UPTO(pri)`` calculates the mask for all priorities up to and including
+ *pri*.
The module defines the following constants:
@@ -100,11 +97,11 @@ A simple set of examples::
syslog.syslog('Processing started')
if error:
- syslog.syslog(syslog.LOG_ERR, 'Processing started')
+ syslog.syslog(syslog.LOG_ERR, 'Processing started')
-An example of setting some log options, these would include the process ID
-in logged messages, and write the messages to the destination facility
-used for mail logging::
+An example of setting some log options, these would include the process ID in
+logged messages, and write the messages to the destination facility used for
+mail logging::
syslog.openlog(logopt=syslog.LOG_PID, facility=syslog.LOG_MAIL)
syslog.syslog('E-mail processing initiated...')