Derived from the flake8-logging-format linter.
What it does#
extra keywords in logging statements that clash with
Why is this bad?#
logging module provides a mechanism for passing additional values to
be logged using the
extra keyword argument. These values are then passed
Providing a value via
extra that clashes with one of the attributes of
LogRecord constructor will raise a
KeyError when the
This rule detects uses of the
logging module via a heuristic.
Specifically, it matches against:
- Uses of the
loggingmodule itself (e.g.,
import logging; logging.info(...)).
- Uses of
from flask import current_app; current_app.logger.info(...)).
- Objects whose name starts with
logor ends with
logging, when used in the same file in which they are defined (e.g.,
logger = logging.getLogger(); logger.info(...)).
- Imported objects marked as loggers via the
logger-objectssetting, which can be used to enforce these rules against shared logger objects (e.g.,
from module import logger; logger.info(...), when
logger-objectsis set to