Improve logging of exceptions from sys.exc_info
This commit is contained in:
@@ -86,7 +86,14 @@ class Logger:
|
||||
self._file_logger.error(text, extra=extra_data)
|
||||
|
||||
def _send_to_plpy(self, level, text, exception=None):
|
||||
exception_message = '. Exception: {}'.format(str(exception)) if exception else ''
|
||||
# exception might also be a tuple generated by sys.exc_info
|
||||
if exception:
|
||||
if isinstance(exception, tuple) and len(exception) > 1:
|
||||
exception = exception[1]
|
||||
exception_message = '. Exception: {}'.format(exception)
|
||||
else:
|
||||
exception_message = ''
|
||||
|
||||
message = '{}{}'.format(text, exception_message)
|
||||
if self._check_plpy():
|
||||
if level == 'debug':
|
||||
|
||||
Reference in New Issue
Block a user