From a6879ede75a24de26d52e1ce6cc38f8013e08d92 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sun, 28 May 2023 14:37:34 -0600 Subject: [PATCH] logging_handler.py: Add debug info for crashes --- resources/logging_handler.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/resources/logging_handler.py b/resources/logging_handler.py index e9dc3a6a0..3dda566a2 100644 --- a/resources/logging_handler.py +++ b/resources/logging_handler.py @@ -1,6 +1,7 @@ import os import sys import time +import pprint import logging import threading import traceback @@ -209,12 +210,7 @@ class InitializeLoggingSupport: Reroute traceback in main thread to logging module """ logging.error("Uncaught exception in main thread", exc_info=(type, value, tb)) - - logging.info("System Information:") - logging.info(f" Host Model Identifier: {self.constants.computer.real_model}") - logging.info(f" macOS Version: {self.constants.detected_os_version}") - logging.info(f" Patcher Version: {self.constants.patcher_version}") - logging.info(f" Arguments passed to Patcher: {sys.argv}") + self._display_debug_properties() if self.constants.cli_mode is True: return @@ -257,3 +253,19 @@ class InitializeLoggingSupport: sys.excepthook = self.original_excepthook threading.excepthook = self.original_thread_excepthook + + + def _display_debug_properties(self) -> None: + """ + Display debug properties, primarily after main thread crash + """ + logging.info("Debug Properties:") + logging.info(f" Effective User ID: {os.geteuid()}") + logging.info(f" Effective Group ID: {os.getegid()}") + logging.info(f" Real User ID: {os.getuid()}") + logging.info(f" Real Group ID: {os.getgid()}") + logging.info(" Arguments passed to Patcher:") + for arg in sys.argv: + logging.info(f" {arg}") + + logging.info(f"Host Properties:\n{pprint.pformat(self.constants.computer.__dict__, indent=4)}")