mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-09 14:24:17 +00:00
Add a lower level for extra verbosity
This commit is contained in:
parent
447a6d4fcc
commit
e2314c38ed
1 changed files with 13 additions and 6 deletions
|
|
@ -30,14 +30,21 @@ del NullHandler
|
||||||
__version__ = '3.0.0a1'
|
__version__ = '3.0.0a1'
|
||||||
|
|
||||||
|
|
||||||
|
# There is nothing lower than logging.DEBUG (10) in the logging library,
|
||||||
|
# but we want an extra level to avoid being too verbose when using -vv.
|
||||||
|
_EXTRA_VERBOSE = 5
|
||||||
|
logging.addLevelName(_EXTRA_VERBOSE, 'VERBOSE')
|
||||||
|
|
||||||
_VERBOSITY_TO_LOG_LEVEL = {
|
_VERBOSITY_TO_LOG_LEVEL = {
|
||||||
# output more than warnings but not debugging info
|
# output more than warnings but not debugging info
|
||||||
1: logging.INFO,
|
1: logging.INFO, # INFO is a numerical level of 20
|
||||||
# output debugging information and everything else
|
# output debugging information
|
||||||
2: logging.DEBUG,
|
2: logging.DEBUG, # DEBUG is a numerical level of 10
|
||||||
|
# output extra verbose debugging information
|
||||||
|
3: _EXTRA_VERBOSE,
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_FORMAT = ('[%(name)-25s]:%(threadName)s %(relativeCreated)6d '
|
LOG_FORMAT = ('%(name)-25s %(processName)-11s %(relativeCreated)6d '
|
||||||
'%(levelname)-8s %(message)s')
|
'%(levelname)-8s %(message)s')
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -54,8 +61,8 @@ def configure_logging(verbosity, filename=None, logformat=LOG_FORMAT):
|
||||||
"""
|
"""
|
||||||
if verbosity <= 0:
|
if verbosity <= 0:
|
||||||
return
|
return
|
||||||
if verbosity > 2:
|
if verbosity > 3:
|
||||||
verbosity = 2
|
verbosity = 3
|
||||||
|
|
||||||
log_level = _VERBOSITY_TO_LOG_LEVEL[verbosity]
|
log_level = _VERBOSITY_TO_LOG_LEVEL[verbosity]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue