Skip to content

Commit

Permalink
Merge pull request pypa#192 from abravalheri/setuptools-issue-3693
Browse files Browse the repository at this point in the history
Backfill `distutils.log.Log` for compatibility
  • Loading branch information
jaraco committed Nov 22, 2022
2 parents e0787fa + 4811c1e commit 3e9d47e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions distutils/log.py
Original file line number Diff line number Diff line change
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
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3e9d47e

Please sign in to comment.