diff --git a/nxc/logger.py b/nxc/logger.py index ce8598a37..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) @@ -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