]> crepu.dev Git - config.git/blame_incremental - djavu-asus/emacs/elpy/rpc-venv/lib/python3.11/site-packages/setuptools/logging.py
Reorganización de directorios
[config.git] / djavu-asus / emacs / elpy / rpc-venv / lib / python3.11 / site-packages / setuptools / logging.py
... / ...
CommitLineData
1import sys
2import inspect
3import logging
4import distutils.log
5from . import monkey
6
7
8def _not_warning(record):
9 return record.levelno < logging.WARNING
10
11
12def configure():
13 """
14 Configure logging to emit warning and above to stderr
15 and everything else to stdout. This behavior is provided
16 for compatibility with distutils.log but may change in
17 the future.
18 """
19 err_handler = logging.StreamHandler()
20 err_handler.setLevel(logging.WARNING)
21 out_handler = logging.StreamHandler(sys.stdout)
22 out_handler.addFilter(_not_warning)
23 handlers = err_handler, out_handler
24 logging.basicConfig(
25 format="{message}", style='{', handlers=handlers, level=logging.DEBUG)
26 if inspect.ismodule(distutils.dist.log):
27 monkey.patch_func(set_threshold, distutils.log, 'set_threshold')
28 # For some reason `distutils.log` module is getting cached in `distutils.dist`
29 # and then loaded again when patched,
30 # implying: id(distutils.log) != id(distutils.dist.log).
31 # Make sure the same module object is used everywhere:
32 distutils.dist.log = distutils.log
33
34
35def set_threshold(level):
36 logging.root.setLevel(level*10)
37 return set_threshold.unpatched(level)