Skip to content

Commit

Permalink
Merge pypa/distutils@3e9d47e with fix for distutils.log (#3705)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 23, 2022
2 parents ad26222 + 1a446a1 commit 77074f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/3693.bugfix.rst
@@ -0,0 +1 @@
Merge pypa/distutils@3e9d47e with compatibility fix for distutils.log.Log.
19 changes: 19 additions & 0 deletions setuptools/_distutils/log.py
Expand Up @@ -5,6 +5,7 @@
"""

import logging
import warnings

from ._log import log as _global_log

Expand Down Expand Up @@ -36,3 +37,21 @@ def set_verbosity(v):
set_threshold(logging.INFO)
elif v >= 2:
set_threshold(logging.DEBUG)


class Log(logging.Logger):
"""distutils.log.Log is deprecated, please use an alternative from `logging`."""

def __init__(self, threshold=WARN):
warnings.warn(Log.__doc__) # avoid DeprecationWarning to ensure warn is shown
super().__init__(__name__, level=threshold)

@property
def threshold(self):
return self.level

@threshold.setter
def threshold(self, level):
self.setLevel(level)

warn = logging.Logger.warning

0 comments on commit 77074f6

Please sign in to comment.