Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow logging.handlers.QueueListener to be used as a context manager #132106

Closed
@csm10495

Description

@csm10495

Feature or enhancement

Proposal:

This is a simple change that would allow:

         with QueueListener(queue, handler1) as listener:
             # the listener has started
             ...
         # the listener has stopped

It's a welcomed alternative to needing to call start/stop manually.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/allow-logging-handlers-queuelistener-to-be-used-as-a-context-manager/87124

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions