Skip to content

Commit

Permalink
Restore protection of distutils.log patching.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 9, 2022
1 parent 177a893 commit a1a5af3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion setuptools/logging.py
Expand Up @@ -24,7 +24,11 @@ def configure():
format="{message}", style='{', handlers=handlers, level=logging.DEBUG)
if hasattr(distutils.log, 'Log'):
monkey.patch_func(set_threshold, distutils.log, 'set_threshold')

# For some reason `distutils.log` module is getting cached in `distutils.dist`
# and then loaded again when patched,
# implying: id(distutils.log) != id(distutils.dist.log).
# Make sure the same module object is used everywhere:
distutils.dist.log = distutils.log

def set_threshold(level):
logging.root.setLevel(level*10)
Expand Down

0 comments on commit a1a5af3

Please sign in to comment.