Preserve logged exc_info across threads

This commit is contained in:
jesopo 2018-12-12 11:33:29 +00:00
parent 98ae6993e4
commit 85840a68dd

View file

@ -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))