Skip to content

Commit 0d2fe6b

Browse files
ronaldoussorenhugovkAlexWaygood
authored
gh-87286: Add a number of LOG_* constants to syslog (#24432)
* bpo-43120: Add a number of LOG_* constants to syslog This adds a number of syslog facilities to the syslogmodule.c. These values are available on macOS. * Switch contant documentation to the data directive This fixes a CI warning and matches the pattern used in the documentation for ``os``. * Update Doc/library/syslog.rst Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent e0fb700 commit 0d2fe6b

File tree

4 files changed

+84
-18
lines changed

4 files changed

+84
-18
lines changed

Doc/library/syslog.rst

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ facility.
1515

1616
This module wraps the system ``syslog`` family of routines. A pure Python
1717
library that can speak to a syslog server is available in the
18-
:mod:`logging.handlers` module as :class:`SysLogHandler`.
18+
:mod:`logging.handlers` module as :class:`~logging.handlers.SysLogHandler`.
1919

2020
The module defines the following functions:
2121

@@ -107,22 +107,62 @@ The module defines the following functions:
107107

108108
The module defines the following constants:
109109

110-
Priority levels (high to low):
111-
:const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:`LOG_ERR`,
112-
:const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`,
113-
:const:`LOG_DEBUG`.
114-
115-
Facilities:
116-
:const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:`LOG_DAEMON`,
117-
:const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:`LOG_UUCP`,
118-
:const:`LOG_CRON`, :const:`LOG_SYSLOG`, :const:`LOG_LOCAL0` to
119-
:const:`LOG_LOCAL7`, and, if defined in ``<syslog.h>``,
120-
:const:`LOG_AUTHPRIV`.
121-
122-
Log options:
123-
:const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined
124-
in ``<syslog.h>``, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and
125-
:const:`LOG_PERROR`.
110+
111+
.. data:: LOG_EMERG
112+
LOG_ALERT
113+
LOG_CRIT
114+
LOG_ERR
115+
LOG_WARNING
116+
LOG_NOTICE
117+
LOG_INFO
118+
LOG_DEBUG
119+
120+
Priority levels (high to low).
121+
122+
123+
.. data:: LOG_AUTH
124+
LOG_AUTHPRIV
125+
LOG_CRON
126+
LOG_DAEMON
127+
LOG_FTP
128+
LOG_INSTALL
129+
LOG_KERN
130+
LOG_LAUNCHD
131+
LOG_LPR
132+
LOG_MAIL
133+
LOG_NETINFO
134+
LOG_NEWS
135+
LOG_RAS
136+
LOG_REMOTEAUTH
137+
LOG_SYSLOG
138+
LOG_USER
139+
LOG_UUCP
140+
LOG_LOCAL0
141+
LOG_LOCAL1
142+
LOG_LOCAL2
143+
LOG_LOCAL3
144+
LOG_LOCAL4
145+
LOG_LOCAL5
146+
LOG_LOCAL6
147+
LOG_LOCAL7
148+
149+
Facilities, depending on availability in ``<syslog.h>`` for :const:`LOG_AUTHPRIV`,
150+
:const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
151+
:const:`LOG_INSTALL` and :const:`LOG_RAS`.
152+
153+
.. versionchanged:: 3.13
154+
Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
155+
:const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD`.
156+
157+
.. data:: LOG_PID
158+
LOG_CONS
159+
LOG_NDELAY
160+
LOG_ODELAY
161+
LOG_NOWAIT
162+
LOG_PERROR
163+
164+
Log options, depending on availability in ``<syslog.h>`` for
165+
:const:`LOG_ODELAY`, :const:`LOG_NOWAIT` and :const:`LOG_PERROR`.
126166

127167

128168
Examples

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Doc/library/ssl.rst
9191
Doc/library/stdtypes.rst
9292
Doc/library/string.rst
9393
Doc/library/subprocess.rst
94-
Doc/library/syslog.rst
9594
Doc/library/tarfile.rst
9695
Doc/library/termios.rst
9796
Doc/library/test.rst
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
2+
:const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD` tot the
3+
:mod:`syslog` module, all of them constants on used on macOS.

Modules/syslogmodule.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,30 @@ syslog_exec(PyObject *module)
406406
ADD_INT_MACRO(module, LOG_AUTHPRIV);
407407
#endif
408408

409+
#ifdef LOG_FTP
410+
ADD_INT_MACRO(module, LOG_FTP);
411+
#endif
412+
413+
#ifdef LOG_NETINFO
414+
ADD_INT_MACRO(module, LOG_NETINFO);
415+
#endif
416+
417+
#ifdef LOG_REMOTEAUTH
418+
ADD_INT_MACRO(module, LOG_REMOTEAUTH);
419+
#endif
420+
421+
#ifdef LOG_INSTALL
422+
ADD_INT_MACRO(module, LOG_INSTALL);
423+
#endif
424+
425+
#ifdef LOG_RAS
426+
ADD_INT_MACRO(module, LOG_RAS);
427+
#endif
428+
429+
#ifdef LOG_LAUNCHD
430+
ADD_INT_MACRO(module, LOG_LAUNCHD);
431+
#endif
432+
409433
return 0;
410434
}
411435

0 commit comments

Comments
 (0)