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 @@ """ 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 diff --git a/pytest.ini b/pytest.ini index 2eb4976d..3f8cc25f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -24,3 +24,6 @@ filterwarnings= # suppress warnings in deprecated compilers ignore:(bcpp|msvc9?)compiler is deprecated + + # suppress well know deprecation warning + ignore:distutils.log.Log is deprecated