@@ -10,66 +10,63 @@ This module provides an interface to the Unix ``syslog`` library routines.
1010Refer to the Unix manual pages for a detailed description of the ``syslog ``
1111facility.
1212
13- This module wraps the system ``syslog `` module . A pure Python
14- library that can speak to a syslog server is available in
15- the :mod: `logging.handlers ` module as :class: `SysLogHandler `.
13+ This module wraps the system ``syslog `` family of routines . A pure Python
14+ library that can speak to a syslog server is available in the
15+ :mod: `logging.handlers ` module as :class: `SysLogHandler `.
1616
1717The module defines the following functions:
1818
1919
2020.. function :: syslog([priority,] message)
2121
22- Send the string *message * to the system logger. A trailing newline is
23- added if necessary. Each message is tagged with a priority composed
24- of a *facility * and a *level *. The optional *priority * argument, which
25- defaults to :const: `LOG_INFO `, determines the message priority. If the
26- facility is not encoded in *priority * using logical-or (``LOG_INFO |
27- LOG_USER ``), the value given in the :func: `openlog ` call is used.
22+ Send the string *message * to the system logger. A trailing newline is added
23+ if necessary. Each message is tagged with a priority composed of a
24+ *facility * and a *level *. The optional *priority * argument, which defaults
25+ to :const: `LOG_INFO `, determines the message priority. If the facility is
26+ not encoded in *priority * using logical-or (``LOG_INFO | LOG_USER ``), the
27+ value given in the :func: `openlog ` call is used.
2828
29- If :func: `openlog ` has not been called prior to the call to
30- :func: 'syslog', ``openlog() `` will be called with no arguments.
29+ If :func: `openlog ` has not been called prior to the call to :func: ` syslog `,
30+ ``openlog() `` will be called with no arguments.
3131
3232
3333.. function :: openlog([ident[, logopt[, facility]]])
3434
35- Logging options of subsequent :func: `syslog ` calls can be set by
36- calling :func: `openlog `. :func: `syslog ` will call :func: `openlog `
37- with no arguments if the log is not currently open.
35+ Logging options of subsequent :func: `syslog ` calls can be set by calling
36+ :func: `openlog `. :func: `syslog ` will call :func: `openlog ` with no arguments
37+ if the log is not currently open.
3838
39- The optional *ident * keyword argument is a string which is prepended
40- to every message, and defaults to ''sys.argv[0]'' with leading
41- path components stripped. The optional *logopt * keyword argument
42- (default=0) is a bit field - see below for possible values to combine.
43- The optional *facility * keyword argument (default=:const: `LOG_USER `)
44- sets the default facility for messages which do not have a facility
45- explicitly encoded.
39+ The optional *ident * keyword argument is a string which is prepended to every
40+ message, and defaults to ``sys.argv[0] `` with leading path components
41+ stripped. The optional *logopt * keyword argument (default is 0) is a bit
42+ field -- see below for possible values to combine. The optional *facility *
43+ keyword argument (default is :const: `LOG_USER `) sets the default facility for
44+ messages which do not have a facility explicitly encoded.
4645
47- .. versionchanged::3.2
48- In previous versions, keyword arguments were not allowed, and *ident*
49- was required. The default for *ident* was dependent on the system
50- libraries, and often was ''python'' instead of the name of the
51- python program file.
46+ .. versionchanged :: 3.2
47+ In previous versions, keyword arguments were not allowed, and *ident * was
48+ required. The default for *ident * was dependent on the system libraries,
49+ and often was ``python `` instead of the name of the python program file.
5250
5351
5452.. function :: closelog()
5553
56- Reset the syslog module values and call the system library
57- ''closelog()''.
54+ Reset the syslog module values and call the system library ``closelog() ``.
5855
59- This causes the module to behave as it does when initially imported.
60- For example, :func: ' openlog' will be called on the first :func: ' syslog'
61- call (if :func: ' openlog' hasn't already been called), and *ident *
62- and other :func: ' openlog' parameters are reset to defaults.
56+ This causes the module to behave as it does when initially imported. For
57+ example, :func: ` openlog ` will be called on the first :func: ` syslog ` call (if
58+ :func: ` openlog ` hasn't already been called), and *ident * and other
59+ :func: ` openlog ` parameters are reset to defaults.
6360
6461
6562.. function :: setlogmask(maskpri)
6663
67- Set the priority mask to *maskpri * and return the previous mask value.
68- Calls to :func: `syslog ` with a priority level not set in *maskpri *
69- are ignored. The default is to log all priorities. The function
70- `` LOG_MASK(pri) `` calculates the mask for the individual priority
71- * pri *. The function ``LOG_UPTO(pri) `` calculates the mask for all
72- priorities up to and including *pri *.
64+ Set the priority mask to *maskpri * and return the previous mask value. Calls
65+ to :func: `syslog ` with a priority level not set in *maskpri * are ignored.
66+ The default is to log all priorities. The function `` LOG_MASK(pri) ``
67+ calculates the mask for the individual priority * pri *. The function
68+ ``LOG_UPTO(pri) `` calculates the mask for all priorities up to and including
69+ *pri *.
7370
7471The module defines the following constants:
7572
@@ -100,11 +97,11 @@ A simple set of examples::
10097
10198 syslog.syslog('Processing started')
10299 if error:
103- syslog.syslog(syslog.LOG_ERR, 'Processing started')
100+ syslog.syslog(syslog.LOG_ERR, 'Processing started')
104101
105- An example of setting some log options, these would include the process ID
106- in logged messages, and write the messages to the destination facility
107- used for mail logging::
102+ An example of setting some log options, these would include the process ID in
103+ logged messages, and write the messages to the destination facility used for
104+ mail logging::
108105
109106 syslog.openlog(logopt=syslog.LOG_PID, facility=syslog.LOG_MAIL)
110107 syslog.syslog('E-mail processing initiated...')
0 commit comments