summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2023-12-12 09:25:51 (GMT)
committerGitHub <noreply@github.com>2023-12-12 09:25:51 (GMT)
commit0d2fe6bab01541301abe98a23ee15a16f493fe74 (patch)
treeb53630231a939d7ce85b8d6d9a6b99dcda246ac2
parente0fb7004ede71389c9dd462cd03352cc3c3a4d8c (diff)
downloadcpython-0d2fe6bab01541301abe98a23ee15a16f493fe74.zip
cpython-0d2fe6bab01541301abe98a23ee15a16f493fe74.tar.gz
cpython-0d2fe6bab01541301abe98a23ee15a16f493fe74.tar.bz2
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 <hugovk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
-rw-r--r--Doc/library/syslog.rst74
-rw-r--r--Doc/tools/.nitignore1
-rw-r--r--Misc/NEWS.d/next/Library/2023-12-07-16-55-41.gh-issue-87286.MILC9_.rst3
-rw-r--r--Modules/syslogmodule.c24
4 files changed, 84 insertions, 18 deletions
diff --git a/Doc/library/syslog.rst b/Doc/library/syslog.rst
index b5ab446..7b27fc7 100644
--- a/Doc/library/syslog.rst
+++ b/Doc/library/syslog.rst
@@ -15,7 +15,7 @@ facility.
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`.
+:mod:`logging.handlers` module as :class:`~logging.handlers.SysLogHandler`.
The module defines the following functions:
@@ -107,22 +107,62 @@ The module defines the following functions:
The module defines the following constants:
-Priority levels (high to low):
- :const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:`LOG_ERR`,
- :const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`,
- :const:`LOG_DEBUG`.
-
-Facilities:
- :const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:`LOG_DAEMON`,
- :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:`LOG_UUCP`,
- :const:`LOG_CRON`, :const:`LOG_SYSLOG`, :const:`LOG_LOCAL0` to
- :const:`LOG_LOCAL7`, and, if defined in ``<syslog.h>``,
- :const:`LOG_AUTHPRIV`.
-
-Log options:
- :const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined
- in ``<syslog.h>``, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and
- :const:`LOG_PERROR`.
+
+.. data:: LOG_EMERG
+ LOG_ALERT
+ LOG_CRIT
+ LOG_ERR
+ LOG_WARNING
+ LOG_NOTICE
+ LOG_INFO
+ LOG_DEBUG
+
+ Priority levels (high to low).
+
+
+.. data:: LOG_AUTH
+ LOG_AUTHPRIV
+ LOG_CRON
+ LOG_DAEMON
+ LOG_FTP
+ LOG_INSTALL
+ LOG_KERN
+ LOG_LAUNCHD
+ LOG_LPR
+ LOG_MAIL
+ LOG_NETINFO
+ LOG_NEWS
+ LOG_RAS
+ LOG_REMOTEAUTH
+ LOG_SYSLOG
+ LOG_USER
+ LOG_UUCP
+ LOG_LOCAL0
+ LOG_LOCAL1
+ LOG_LOCAL2
+ LOG_LOCAL3
+ LOG_LOCAL4
+ LOG_LOCAL5
+ LOG_LOCAL6
+ LOG_LOCAL7
+
+ Facilities, depending on availability in ``<syslog.h>`` for :const:`LOG_AUTHPRIV`,
+ :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
+ :const:`LOG_INSTALL` and :const:`LOG_RAS`.
+
+ .. versionchanged:: 3.13
+ Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
+ :const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD`.
+
+.. data:: LOG_PID
+ LOG_CONS
+ LOG_NDELAY
+ LOG_ODELAY
+ LOG_NOWAIT
+ LOG_PERROR
+
+ Log options, depending on availability in ``<syslog.h>`` for
+ :const:`LOG_ODELAY`, :const:`LOG_NOWAIT` and :const:`LOG_PERROR`.
Examples
diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore
index 511648a..75d50fe 100644
--- a/Doc/tools/.nitignore
+++ b/Doc/tools/.nitignore
@@ -91,7 +91,6 @@ Doc/library/ssl.rst
Doc/library/stdtypes.rst
Doc/library/string.rst
Doc/library/subprocess.rst
-Doc/library/syslog.rst
Doc/library/tarfile.rst
Doc/library/termios.rst
Doc/library/test.rst
diff --git a/Misc/NEWS.d/next/Library/2023-12-07-16-55-41.gh-issue-87286.MILC9_.rst b/Misc/NEWS.d/next/Library/2023-12-07-16-55-41.gh-issue-87286.MILC9_.rst
new file mode 100644
index 0000000..bfeec3c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-12-07-16-55-41.gh-issue-87286.MILC9_.rst
@@ -0,0 +1,3 @@
+Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`,
+:const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD` tot the
+:mod:`syslog` module, all of them constants on used on macOS.
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index 6a44850..62c7816 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -406,6 +406,30 @@ syslog_exec(PyObject *module)
ADD_INT_MACRO(module, LOG_AUTHPRIV);
#endif
+#ifdef LOG_FTP
+ ADD_INT_MACRO(module, LOG_FTP);
+#endif
+
+#ifdef LOG_NETINFO
+ ADD_INT_MACRO(module, LOG_NETINFO);
+#endif
+
+#ifdef LOG_REMOTEAUTH
+ ADD_INT_MACRO(module, LOG_REMOTEAUTH);
+#endif
+
+#ifdef LOG_INSTALL
+ ADD_INT_MACRO(module, LOG_INSTALL);
+#endif
+
+#ifdef LOG_RAS
+ ADD_INT_MACRO(module, LOG_RAS);
+#endif
+
+#ifdef LOG_LAUNCHD
+ ADD_INT_MACRO(module, LOG_LAUNCHD);
+#endif
+
return 0;
}