"""Customize logging Defines custom logger class for the `logger.verbose(...)` method. init_logging() must be called before any other modules that call logging.getLogger. """ import logging from typing import Any, cast # custom log level for `--verbose` output # between DEBUG and INFO VERBOSE = 15 class VerboseLogger(logging.Logger): """Custom Logger, defining a verbose log-level VERBOSE is between INFO and DEBUG. """ def verbose(self, msg: str, *args: Any, **kwargs: Any) -> None: return self.log(VERBOSE, msg, *args, **kwargs) def getLogger(name: str) -> VerboseLogger: """logging.getLogger, but ensures our VerboseLogger class is returned""" return cast(VerboseLogger, logging.getLogger(name)) def init_logging() -> None: """Register our VerboseLogger and VERBOSE log level. Should be called before any calls to getLogger(), i.e. in pip._internal.__init__ """ logging.setLoggerClass(VerboseLogger) logging.addLevelName(VERBOSE, "VERBOSE")
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 0 B | 0644 |
|
_jaraco_text.py | File | 3.27 KB | 0644 |
|
_log.py | File | 1015 B | 0644 |
|
appdirs.py | File | 1.63 KB | 0644 |
|
compat.py | File | 2.34 KB | 0644 |
|
compatibility_tags.py | File | 6.13 KB | 0644 |
|
datetime.py | File | 242 B | 0644 |
|
deprecation.py | File | 3.62 KB | 0644 |
|
direct_url_helpers.py | File | 3.12 KB | 0644 |
|
egg_link.py | File | 2.41 KB | 0644 |
|
encoding.py | File | 1.14 KB | 0644 |
|
entrypoints.py | File | 2.99 KB | 0644 |
|
filesystem.py | File | 4.83 KB | 0644 |
|
filetypes.py | File | 716 B | 0644 |
|
glibc.py | File | 3.65 KB | 0644 |
|
hashes.py | File | 4.86 KB | 0644 |
|
logging.py | File | 11.33 KB | 0644 |
|
misc.py | File | 22.98 KB | 0644 |
|
packaging.py | File | 2.06 KB | 0644 |
|
retry.py | File | 1.36 KB | 0644 |
|
setuptools_build.py | File | 4.33 KB | 0644 |
|
subprocess.py | File | 8.78 KB | 0644 |
|
temp_dir.py | File | 9.09 KB | 0644 |
|
unpacking.py | File | 11.67 KB | 0644 |
|
urls.py | File | 1.56 KB | 0644 |
|
virtualenv.py | File | 3.38 KB | 0644 |
|
wheel.py | File | 4.39 KB | 0644 |
|