summaryrefslogtreecommitdiff
path: root/distutils
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-11-22 18:53:08 -0500
committerGitHub <noreply@github.com>2022-11-22 18:53:08 -0500
commit3e9d47e0f631a92cc0251ac212a14cad9570f76b (patch)
treeb16526a2609dfca9b5aaf0fb4aadc98427529255 /distutils
parente0787fad7c03d8defbbaaaf2888130cc2a171537 (diff)
parent4811c1e3e1e0c3f6d51bd8a32a91f022c299ba95 (diff)
downloadpython-setuptools-git-3e9d47e0f631a92cc0251ac212a14cad9570f76b.tar.gz
Merge pull request #192 from abravalheri/setuptools-issue-3693
Backfill `distutils.log.Log` for compatibility
Diffstat (limited to 'distutils')
-rw-r--r--distutils/log.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/distutils/log.py b/distutils/log.py
index bb789c30..239f3158 100644
--- a/distutils/log.py
+++ b/distutils/log.py
@@ -5,6 +5,7 @@ Retained for compatibility and should not be used.
"""
import logging
+import warnings
from ._log import log as _global_log
@@ -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