mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-132106: Allow logging.handlers.QueueListener
to be used as a context manager (#132107)
This commit is contained in:
parent
ad3bbe8fbc
commit
517e96b9ed
6 changed files with 54 additions and 6 deletions
|
@ -626,6 +626,19 @@ which, when run, will produce:
|
|||
of each message with the handler's level, and only passes a message to a
|
||||
handler if it's appropriate to do so.
|
||||
|
||||
.. versionchanged:: next
|
||||
The :class:`QueueListener` can be started (and stopped) via the
|
||||
:keyword:`with` statement. For example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
with QueueListener(que, handler) as listener:
|
||||
# The queue listener automatically starts
|
||||
# when the 'with' block is entered.
|
||||
pass
|
||||
# The queue listener automatically stops once
|
||||
# the 'with' block is exited.
|
||||
|
||||
.. _network-logging:
|
||||
|
||||
Sending and receiving logging events across a network
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue