Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions