logging: filter out taskName that is added by Python 3.12

fixes #267.
This commit is contained in:
lilydjwg 2024-04-24 10:02:14 +08:00
parent f1ff604b4c
commit c367b49703
2 changed files with 8 additions and 1 deletions

View File

@ -78,6 +78,7 @@ def process_common_arguments(args: argparse.Namespace) -> bool:
slogconf.exc_info,
slogconf.filter_exc,
slogconf.filter_nones,
slogconf.filter_taskname,
]
logger_factory = None

View File

@ -1,6 +1,6 @@
# vim: se sw=2:
# MIT licensed
# Copyright (c) 2018 lilydjwg <lilydjwg@gmail.com>, et al.
# Copyright (c) 2018-2020,2023-2024 lilydjwg <lilydjwg@gmail.com>, et al.
import logging
import os
@ -44,6 +44,12 @@ def filter_nones(logger, level, event):
del event['url']
return event
def filter_taskname(logger, level, event):
# added in Python 3.12, not useful to us, but appears as a normal KV.
if 'taskName' in event:
del event['taskName']
return event
def filter_exc(logger, level, event):
exc_info = event.get('exc_info')
if not exc_info: