Skip to content

Commit a677b37

Browse files
Merge pull request Pennyw0rth#290 from Pennyw0rth/marshall-fix-logging
Reduce third party debug logging
2 parents 25f0b59 + 0ca3c43 commit a677b37

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

nxc/logger.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def setup_debug_logging():
3030
root_logger.setLevel(logging.INFO)
3131
elif debug_args.debug:
3232
nxc_logger.logger.setLevel(logging.DEBUG)
33-
root_logger.setLevel(logging.DEBUG)
33+
root_logger.setLevel(logging.INFO)
3434
else:
3535
nxc_logger.logger.setLevel(logging.ERROR)
3636
root_logger.setLevel(logging.ERROR)
@@ -53,13 +53,15 @@ def __init__(self, formatter=None, *args, **kwargs):
5353

5454
def emit(self, record):
5555
"""Overrides the emit method of the RichHandler class so we can set the proper pathname and lineno"""
56+
# for some reason in RDP, the exc_text is None which leads to a KeyError in Python logging
57+
record.exc_text = record.getMessage() if record.exc_text is None else record.exc_text
58+
5659
if hasattr(record, "caller_frame"):
5760
frame_info = inspect.getframeinfo(record.caller_frame)
5861
record.pathname = frame_info.filename
5962
record.lineno = frame_info.lineno
6063
super().emit(record)
6164

62-
6365
def no_debug(func):
6466
"""Stops logging non-debug messages when we are in debug mode
6567
It creates a temporary logger and logs the message to the console and file

0 commit comments

Comments
 (0)