]> crepu.dev Git - config.git/blame - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/setuptools/_distutils/log.py
ActualizaciĆ³n de Readme
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / setuptools / _distutils / log.py
CommitLineData
53e6db90
DC
1"""
2A simple log mechanism styled after PEP 282.
3
4Retained for compatibility and should not be used.
5"""
6
7import logging
8import warnings
9
10from ._log import log as _global_log
11
12
13DEBUG = logging.DEBUG
14INFO = logging.INFO
15WARN = logging.WARN
16ERROR = logging.ERROR
17FATAL = logging.FATAL
18
19log = _global_log.log
20debug = _global_log.debug
21info = _global_log.info
22warn = _global_log.warning
23error = _global_log.error
24fatal = _global_log.fatal
25
26
27def set_threshold(level):
28 orig = _global_log.level
29 _global_log.setLevel(level)
30 return orig
31
32
33def set_verbosity(v):
34 if v <= 0:
35 set_threshold(logging.WARN)
36 elif v == 1:
37 set_threshold(logging.INFO)
38 elif v >= 2:
39 set_threshold(logging.DEBUG)
40
41
42class Log(logging.Logger):
43 """distutils.log.Log is deprecated, please use an alternative from `logging`."""
44
45 def __init__(self, threshold=WARN):
46 warnings.warn(Log.__doc__) # avoid DeprecationWarning to ensure warn is shown
47 super().__init__(__name__, level=threshold)
48
49 @property
50 def threshold(self):
51 return self.level
52
53 @threshold.setter
54 def threshold(self, level):
55 self.setLevel(level)
56
57 warn = logging.Logger.warning