Commit 9acea8ad authored by Ozzie Isaacs's avatar Ozzie Isaacs

Fixed logging of exception in debug_or_exception handler for python version <3.8

parent e5f754ed
...@@ -44,10 +44,22 @@ logging.addLevelName(logging.CRITICAL, "CRIT") ...@@ -44,10 +44,22 @@ logging.addLevelName(logging.CRITICAL, "CRIT")
class _Logger(logging.Logger): class _Logger(logging.Logger):
def debug_or_exception(self, message, *args, **kwargs): def debug_or_exception(self, message, *args, **kwargs):
if is_debug_enabled(): if sys.version_info > (3, 7):
self.exception(message, stacklevel=2, *args, **kwargs) if is_debug_enabled():
self.exception(message, stacklevel=2, *args, **kwargs)
else:
self.error(message, stacklevel=2, *args, **kwargs)
elif sys.version_info > (3, 0):
if is_debug_enabled():
self.exception(message, stack_info=True, *args, **kwargs)
else:
self.error(message, *args, **kwargs)
else: else:
self.error(message, stacklevel=2, *args, **kwargs) if is_debug_enabled():
self.exception(message, *args, **kwargs)
else:
self.error(message, *args, **kwargs)
def debug_no_auth(self, message, *args, **kwargs): def debug_no_auth(self, message, *args, **kwargs):
if message.startswith("send: AUTH"): if message.startswith("send: AUTH"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment