mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] Add more syslog tests (GH-97953). (GH-98096)
(cherry picked from commit cae7d1d7a7
)
This commit is contained in:
parent
bdc1087724
commit
f6e50b82f6
4 changed files with 97 additions and 7 deletions
|
@ -419,6 +419,27 @@ def test_sys_getframe():
|
|||
sys._getframe()
|
||||
|
||||
|
||||
def test_syslog():
|
||||
import syslog
|
||||
|
||||
def hook(event, args):
|
||||
if event.startswith("syslog."):
|
||||
print(event, *args)
|
||||
|
||||
sys.addaudithook(hook)
|
||||
syslog.openlog('python')
|
||||
syslog.syslog('test')
|
||||
syslog.setlogmask(syslog.LOG_DEBUG)
|
||||
syslog.closelog()
|
||||
# implicit open
|
||||
syslog.syslog('test2')
|
||||
# open with default ident
|
||||
syslog.openlog(logoption=syslog.LOG_NDELAY, facility=syslog.LOG_LOCAL0)
|
||||
sys.argv = None
|
||||
syslog.openlog()
|
||||
syslog.closelog()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from test.support import suppress_msvcrt_asserts
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue