From 867677115cb2baade8aa88105ff62e102c08c4ea Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sat, 9 Mar 2024 06:59:51 -0500 Subject: [PATCH] fix exception logging --- installer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/installer.py b/installer.py index 24bf70864..5a105db90 100644 --- a/installer.py +++ b/installer.py @@ -67,7 +67,12 @@ def setup_logging(): self.formatter = logging.Formatter('{ "asctime":"%(asctime)s", "created":%(created)f, "facility":"%(name)s", "pid":%(process)d, "tid":%(thread)d, "level":"%(levelname)s", "module":"%(module)s", "func":"%(funcName)s", "msg":"%(message)s" }') def emit(self, record): - record.msg = record.msg.replace('"', "'") + if record.msg is not None and not isinstance(record.msg, str): + record.msg = str(record.msg) + try: + record.msg = record.msg.replace('"', "'") + except Exception: + pass msg = self.format(record) # self.buffer.append(json.loads(msg)) self.buffer.append(msg)