From 85840a68ddc5b012a2de038155036ec1113f5b5f Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 12 Dec 2018 11:33:29 +0000 Subject: [PATCH] Preserve logged exc_info across threads --- src/Logging.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Logging.py b/src/Logging.py index 53275686..60c008a6 100644 --- a/src/Logging.py +++ b/src/Logging.py @@ -77,4 +77,8 @@ class Log(object): def critical(self, message: str, params: typing.List, **kwargs): self._log(message, params, logging.CRITICAL, kwargs) def _log(self, message: str, params: typing.List, level: int, kwargs: dict): + if kwargs.get("exc_info") == True: + # because we're doing the actual logging on another thread, + # we need to catch actual exception information here. + kwargs["exc_info"] = sys.exc_info() self._queue.put((message, params, level, kwargs))