sentry
sentry copied to clipboard
fix(logging): updating logging 'throwaways' to Python 3.12 + adding Formatter fields
Underlying problem — flake8-logging
does not fully catch these if they're coming for a dynamic dictionary rather than a literal.
Changes:
- Updating the
throwaway
list ofextra
fields that class withLogRecord
fields to Python 3; - Adding
"message"
and"asctime"
which are injected intoLogRecord
viaFormatter
and also cause clashes; - Adding
"taskName"
for forwards compatibility with Python 3.12;
The list can be also be auto-generated via:
_rec = logging.makeLogRecord({})
logging.Formatter("%(asctime)s:%(levelname)s:%(name)s:%(message)s").format(_rec)
throwaways = frozenset(rec.__dict__.keys())