mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-21 21:11:32 +00:00
Check for a generic Mapping type instead of dict
This commit is contained in:
parent
1b274fa019
commit
52280acf41
@ -2,6 +2,7 @@
|
||||
from datetime import datetime
|
||||
from typing import TextIO, Union
|
||||
from dataclasses import dataclass
|
||||
from collections.abc import Mapping
|
||||
from traceback import format_exception
|
||||
from logging import DEBUG, getLogger, Handler, Formatter, Filter
|
||||
|
||||
@ -81,7 +82,7 @@ class LogFormatter(Formatter):
|
||||
def format(self, record):
|
||||
time = datetime.utcfromtimestamp(record.created).strftime('%H:%M:%S')
|
||||
if record.args:
|
||||
tuple_args = (record.args,) if isinstance(record.args, dict) else record.args
|
||||
tuple_args = (record.args,) if isinstance(record.args, Mapping) else record.args
|
||||
clean_args = tuple((self.trim(arg) for arg in tuple_args))
|
||||
message = record.msg % clean_args
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user