Logging Fix
This commit is contained in:
@@ -33,9 +33,10 @@ def configure_logging(enabled: bool = False, level: str = "WARNING") -> None:
|
|||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
def error_with_traceback(msg, *args, **kwargs):
|
def error_with_traceback(msg, *args, **kwargs):
|
||||||
if isinstance(kwargs.get('exception', None), Exception):
|
# If exc_info is True, include traceback in the message
|
||||||
|
if kwargs.get('exc_info', False):
|
||||||
full_msg = f"{msg}\n{traceback.format_exc()}"
|
full_msg = f"{msg}\n{traceback.format_exc()}"
|
||||||
_original_error(full_msg, *args, **{**kwargs, 'exc_info': False})
|
_original_error(full_msg, *args, **{k: v for k, v in kwargs.items() if k != 'exc_info'})
|
||||||
else:
|
else:
|
||||||
_original_error(msg, *args, **kwargs)
|
_original_error(msg, *args, **kwargs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user