Skip to content

Commit 9d558d9

Browse files
committed
Remove unnecessary exception info which results in double logs, caused by kwargs passed as exc_info in log record
1 parent 05ad3c6 commit 9d558d9

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

nxc/logger.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def create_temp_logger(caller_frame, formatted_text, args, kwargs):
4343
temp_logger = logging.getLogger("temp")
4444
formatter = logging.Formatter("%(message)s", datefmt="[%X]")
4545
handler = SmartDebugRichHandler(formatter=formatter)
46-
handler.handle(LogRecord(temp_logger.name, logging.INFO, caller_frame.f_code.co_filename, caller_frame.f_lineno, formatted_text, args, kwargs, caller_frame=caller_frame))
46+
handler.handle(LogRecord(temp_logger.name, logging.INFO, caller_frame.f_code.co_filename, caller_frame.f_lineno, formatted_text, args, None, caller_frame=caller_frame))
4747

4848

4949
class SmartDebugRichHandler(RichHandler):
@@ -56,9 +56,6 @@ def __init__(self, formatter=None, *args, **kwargs):
5656

5757
def emit(self, record):
5858
"""Overrides the emit method of the RichHandler class so we can set the proper pathname and lineno"""
59-
# for some reason in RDP, the exc_text is None which leads to a KeyError in Python logging
60-
record.exc_text = record.getMessage() if record.exc_text is None else record.exc_text
61-
6259
if hasattr(record, "caller_frame"):
6360
frame_info = inspect.getframeinfo(record.caller_frame)
6461
record.pathname = frame_info.filename

0 commit comments

Comments
 (0)