This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbrugman
Recipients sbrugman
Date 2020-02-19.16:08:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582128517.71.0.784549990628.issue39589@roundup.psfhosted.org>
In-reply-to
Content
The QueueListener in the logging library starts a background thread to monitor the log event queue. The context manager support is ideal in this case, making the code simpler, more consistent with other classes (e.g. multiprocessing.Pool) and prompts stopping the thread.

Without support for the context manager we need the following code:

```
queue_listener = QueueListener(queue, handler)
queue_listener.start()
# queue messages
queue_listener.stop()
```

adding context manager support would result in the following equivalent code:

```
with QueueListener(queue, handler) as queue_listener:
    # queue messages
```
History
Date User Action Args
2020-02-19 16:08:37sbrugmansetrecipients: + sbrugman
2020-02-19 16:08:37sbrugmansetmessageid: <1582128517.71.0.784549990628.issue39589@roundup.psfhosted.org>
2020-02-19 16:08:37sbrugmanlinkissue39589 messages
2020-02-19 16:08:37sbrugmancreate