Skip to content

Commit

Permalink
logging: filter out taskName that is added by Python 3.12
Browse files Browse the repository at this point in the history
fixes #267.
  • Loading branch information
lilydjwg committed Apr 24, 2024
1 parent f1ff604 commit c367b49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions nvchecker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion nvchecker/slogconf.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c367b49

Please sign in to comment.