From 045a9649fd5422c88a003ee31e451a06ebbd4185 Mon Sep 17 00:00:00 2001 From: Marshall Hallenbeck Date: Fri, 3 May 2024 15:36:40 -0400 Subject: [PATCH 1/2] fix(logger): set exc_text to error text if it is none (found via 288) --- nxc/logger.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nxc/logger.py b/nxc/logger.py index ce8598a37..3d5c67ac1 100755 --- a/nxc/logger.py +++ b/nxc/logger.py @@ -53,13 +53,15 @@ def __init__(self, formatter=None, *args, **kwargs): def emit(self, record): """Overrides the emit method of the RichHandler class so we can set the proper pathname and lineno""" + # for some reason in RDP, the exc_text is None which leads to a KeyError in Python logging + record.exc_text = record.getMessage() if record.exc_text is None else record.exc_text + if hasattr(record, "caller_frame"): frame_info = inspect.getframeinfo(record.caller_frame) record.pathname = frame_info.filename record.lineno = frame_info.lineno super().emit(record) - def no_debug(func): """Stops logging non-debug messages when we are in debug mode It creates a temporary logger and logs the message to the console and file From 0ca3c43f02ff5e603b5d51e279dc6dac636a2ba4 Mon Sep 17 00:00:00 2001 From: Marshall Hallenbeck Date: Fri, 3 May 2024 15:48:49 -0400 Subject: [PATCH 2/2] fix(logger): set overall logging level to INFO for third party loggers instead of DEBUG when --debug is set --- nxc/logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nxc/logger.py b/nxc/logger.py index 3d5c67ac1..0d71268a5 100755 --- a/nxc/logger.py +++ b/nxc/logger.py @@ -30,7 +30,7 @@ def setup_debug_logging(): root_logger.setLevel(logging.INFO) elif debug_args.debug: nxc_logger.logger.setLevel(logging.DEBUG) - root_logger.setLevel(logging.DEBUG) + root_logger.setLevel(logging.INFO) else: nxc_logger.logger.setLevel(logging.ERROR) root_logger.setLevel(logging.ERROR)