Repository navigation
[Gecko Bug 2047805] Make logger owner call shutdown() - #60846
Merged
Merged
Conversation
Instead of providing setup_logging functions that return a logger but don't handle any cleanup, provide context managers that clean up the logging configuration. In particular wptlogging.LoggingManager will call shutdown on the logger iff it created the logger in the first place. Where we store the logger as a global variable we wrap in a GlobalLogger class that knows how to set the global state and unsets it at the end. Rather inelegantly, the interaction with globals means we end up copying a lot of code around. Differential Revision: https://phabricator.services.mozilla.com/D306960 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2047805 gecko-commit: 9710b7ec0bf1ce280a6109d24ab107c09fa748c9 gecko-commit-git: b4375e893697bf45fcb5f15884b6c9d064a99e30 gecko-reviewers: Sasha
wpt-pr-bot
approved these changes
Jun 24, 2026
wpt-pr-bot
left a comment
Collaborator
There was a problem hiding this comment.
The review process for this patch is being conducted in the Firefox project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of providing setup_logging functions that return a logger but
don't handle any cleanup, provide context managers that clean up the
logging configuration.
In particular wptlogging.LoggingManager will call shutdown on the
logger iff it created the logger in the first place.
Where we store the logger as a global variable we wrap in a
GlobalLogger class that knows how to set the global state and unsets
it at the end. Rather inelegantly, the interaction with globals means
we end up copying a lot of code around.
Differential Revision: https://phabricator.services.mozilla.com/D306960
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2047805
gecko-commit: 9710b7ec0bf1ce280a6109d24ab107c09fa748c9
gecko-commit-git: b4375e893697bf45fcb5f15884b6c9d064a99e30
gecko-reviewers: Sasha