Add externalPythonDependencies logging category#18067
Merged
Merged
Conversation
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.
Link to issue number:
Follow up for #10393
Summary of the issue:
Since #10393, we log at level warning or higher for external Python dependencies. There is no way to enable logging at lower levels, such as debug. This can however be pretty helpful for external dependencies like comtypes to see what's going on under the hood.
Description of user facing changes
Have extra logging when a new debugging category,
externalPythonDependencies, is enabled.Description of development approach
The overall logging level is now determined from the level of the root logger, which is no longer limited to a minimum of WARNING. Instead, a filter is implemented on the handler that filters appropriately. Note that initially, it made sense to add this filter to the root logger, but filters don't propagate from the root logger to all loggers below.
Testing strategy:
Calling
comtypes.CoInitializewith and without the new category enabled, logging at level debug. Ensured that behavior was as expected (i.e. comtypes logged when the category was enabled)Known issues with pull request:
In #10393, I mentioned issues with re-entrancy when comtypes logs at level debug. I have not yet reproduced this. That said, the logging categories are documented in such a way that they should only be enabled on request. I don't think this needs extra documentation.
Code Review Checklist:
@coderabbitai summary