mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Added respect_handler_level to QueueListener.
This commit is contained in:
parent
438f9134cf
commit
365701add9
5 changed files with 50 additions and 6 deletions
|
@ -3006,6 +3006,25 @@ class QueueHandlerTest(BaseTest):
|
|||
self.assertTrue(handler.matches(levelno=logging.WARNING, message='1'))
|
||||
self.assertTrue(handler.matches(levelno=logging.ERROR, message='2'))
|
||||
self.assertTrue(handler.matches(levelno=logging.CRITICAL, message='3'))
|
||||
handler.close()
|
||||
|
||||
# Now test with respect_handler_level set
|
||||
|
||||
handler = support.TestHandler(support.Matcher())
|
||||
handler.setLevel(logging.CRITICAL)
|
||||
listener = logging.handlers.QueueListener(self.queue, handler,
|
||||
respect_handler_level=True)
|
||||
listener.start()
|
||||
try:
|
||||
self.que_logger.warning(self.next_message())
|
||||
self.que_logger.error(self.next_message())
|
||||
self.que_logger.critical(self.next_message())
|
||||
finally:
|
||||
listener.stop()
|
||||
self.assertFalse(handler.matches(levelno=logging.WARNING, message='4'))
|
||||
self.assertFalse(handler.matches(levelno=logging.ERROR, message='5'))
|
||||
self.assertTrue(handler.matches(levelno=logging.CRITICAL, message='6'))
|
||||
|
||||
|
||||
ZERO = datetime.timedelta(0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue