From 52280acf41a0537b407c4340e6e861e58ae374d3 Mon Sep 17 00:00:00 2001 From: "R. Richard" Date: Tue, 12 Nov 2019 14:23:09 +0100 Subject: [PATCH] Check for a generic Mapping type instead of dict --- tfw/logging.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tfw/logging.py b/tfw/logging.py index dad7499..f05958e 100644 --- a/tfw/logging.py +++ b/tfw/logging.py @@ -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: