Replace usage of undocumented logging.WARN

For some reason these are not caught by flake8-logging checks by ruff,
though.

Change-Id: If2c3febf73b49590e3a75f7eac3ffae5fe509d66
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2026-02-21 23:07:34 +09:00
parent 619368260c
commit 1a376c3e94
2 changed files with 6 additions and 6 deletions

View File

@@ -292,7 +292,7 @@ def fdopen(fd: int, *args: Any, **kwargs: Any) -> Any:
return open(fd, *args, **kwargs)
def _fd_logger(level: int = logging.WARN) -> Any:
def _fd_logger(level: int = logging.WARNING) -> Any:
"""Helper that returns a file object that is asynchronously logged"""
read_fd, write_fd = os.pipe()
read_end = fdopen(read_fd, 'r', 1)

View File

@@ -99,7 +99,7 @@ class LogTest(testctx.TestContextTestCase):
# These write to the log on the priv side
logme(logging.DEBUG, 'test@DEBUG')
logme(logging.WARN, 'test@WARN')
logme(logging.WARNING, 'test@WARN')
time.sleep(0.1) # Hack to give logging thread a chance to run
@@ -123,7 +123,7 @@ class LogTest(testctx.TestContextTestCase):
)
try:
logme(logging.WARN, 'test with exc', exc_info=True)
logme(logging.WARNING, 'test with exc', exc_info=True)
except Exception: # noqa: S110
pass
@@ -139,7 +139,7 @@ class LogTest(testctx.TestContextTestCase):
'PrivContext(cfg_section=privsep)', record.processName
)
self.assertIn('test_daemon.py', record.exc_text)
self.assertEqual(logging.WARN, record.levelno)
self.assertEqual(logging.WARNING, record.levelno)
self.assertEqual('logme', record.funcName)
def test_format_record(self):
@@ -156,7 +156,7 @@ class LogTest(testctx.TestContextTestCase):
)
)
logme(logging.WARN, 'test with exc', exc_info=True)
logme(logging.WARNING, 'test with exc', exc_info=True)
time.sleep(0.1) # Hack to give logging thread a chance to run
@@ -204,7 +204,7 @@ class LogTestDaemonTraceback(testctx.TestContextTestCase):
self.assertIn('Privsep daemon traceback: ', record.getMessage())
self.assertIsNone(record.exc_info)
self.assertEqual('MainProcess', record.processName)
self.assertEqual(logging.WARN, record.levelno)
self.assertEqual(logging.WARNING, record.levelno)
@testtools.skipIf(