From 44e0fcba336cb14a5fcf2f7b26e45c861cfbdc38 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 29 Dec 2020 17:01:05 +0100 Subject: [PATCH] exception is set with direct set of key which is faster and expplicit --- pype/lib/log.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pype/lib/log.py b/pype/lib/log.py index 55c6da0be6..dde8fa9452 100644 --- a/pype/lib/log.py +++ b/pype/lib/log.py @@ -232,13 +232,12 @@ class PypeMongoFormatter(logging.Formatter): } # Standard document decorated with exception info if record.exc_info is not None: - document.update({ - 'exception': { - 'message': str(record.exc_info[1]), - 'code': 0, - 'stackTrace': self.formatException(record.exc_info) - } - }) + document['exception'] = { + 'message': str(record.exc_info[1]), + 'code': 0, + 'stackTrace': self.formatException(record.exc_info) + } + # Standard document decorated with extra contextual information if len(self.DEFAULT_PROPERTIES) != len(record.__dict__): contextual_extra = set(record.__dict__).difference(