mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 10:46:54 +00:00
Make log format configurable
This commit is contained in:
parent
cb9231eb9b
commit
6940ef3aaf
1 changed files with 3 additions and 4 deletions
|
|
@ -39,7 +39,8 @@ _VERBOSITY_TO_LOG_LEVEL = {
|
|||
}
|
||||
|
||||
|
||||
def configure_logging(verbosity, filename=None):
|
||||
def configure_logging(verbosity, filename=None,
|
||||
logformat='%(asctime)s %(levelname)s %(message)s'):
|
||||
"""Configure logging for flake8.
|
||||
|
||||
:param int verbosity:
|
||||
|
|
@ -63,9 +64,7 @@ def configure_logging(verbosity, filename=None):
|
|||
else:
|
||||
handler = logging.FileHandler(filename)
|
||||
|
||||
handler.setFormatter(
|
||||
logging.Formatter('%(asctime)s %(levelname)s %(message)s')
|
||||
)
|
||||
handler.setFormatter(logging.Formatter(logformat))
|
||||
LOG.addHandler(handler)
|
||||
LOG.setLevel(log_level)
|
||||
LOG.debug('Added a %s logging handler to logger root at %s',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue