From cada66a6b5c4c168d5b15c5cb02897ade3fb2274 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Fri, 2 Jun 2023 12:11:32 -0600 Subject: [PATCH] Add safe guards for logging --- resources/analytics_handler.py | 3 +++ resources/logging_handler.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/resources/analytics_handler.py b/resources/analytics_handler.py index 637bed0051..fbdac3e2fd 100644 --- a/resources/analytics_handler.py +++ b/resources/analytics_handler.py @@ -64,6 +64,9 @@ def send_crash_report(self, log_file: Path) -> None: return if not log_file.exists(): return + if self.constants.commit_info[0].startswith("refs/tags"): + # Avoid being overloaded with crash reports + return commit_info = self.constants.commit_info[0].split("/")[-1] + "_" + self.constants.commit_info[1].split("T")[0] + "_" + self.constants.commit_info[2].split("/")[-1] diff --git a/resources/logging_handler.py b/resources/logging_handler.py index 292f27cc11..c6b64ad937 100644 --- a/resources/logging_handler.py +++ b/resources/logging_handler.py @@ -228,7 +228,11 @@ def custom_excepthook(type, value, tb) -> None: error_msg += f"\n\n{traceback.extract_tb(tb)[-1]}" cant_log: bool = global_settings.GlobalEnviromentSettings().read_property("DisableCrashAndAnalyticsReporting") + if not isinstance(cant_log, bool): + cant_log = False + if self.constants.commit_info[0].startswith("refs/tags"): + cant_log = True if cant_log is True: error_msg += "\n\nReveal log file?"