def log(self, log_type: str, message: str) -> None: level = self._translateLogType(log_type) message = CrashHandler.pruneSensitiveData(message) if level is None: if message not in self._show_once: level = self._translateLogType(log_type[0]) if level is not None: self._show_once.add(message) add_breadcrumb(level=level, message=message) else: add_breadcrumb(level=level, message=message)
def exceptHook(hook_type, value, traceback): from cura.CrashHandler import CrashHandler from cura.CuraApplication import CuraApplication has_started = False if CuraApplication.Created: has_started = CuraApplication.getInstance().started # # When the exception hook is triggered, the QApplication may not have been initialized yet. In this case, we don't # have an QApplication to handle the event loop, which is required by the Crash Dialog. # The flag "CuraApplication.Created" is set to True when CuraApplication finishes its constructor call. # # Before the "started" flag is set to True, the Qt event loop has not started yet. The event loop is a blocking # call to the QApplication.exec_(). In this case, we need to: # 1. Remove all scheduled events so no more unnecessary events will be processed, such as loading the main dialog, # loading the machine, etc. # 2. Start the Qt event loop with exec_() and show the Crash Dialog. # # If the application has finished its initialization and was running fine, and then something causes a crash, # we run the old routine to show the Crash Dialog. # from PyQt5.Qt import QApplication if CuraApplication.Created: _crash_handler = CrashHandler(hook_type, value, traceback, has_started) if CuraApplication.splash is not None: CuraApplication.splash.close() if not has_started: CuraApplication.getInstance().removePostedEvents(None) _crash_handler.early_crash_dialog.show() sys.exit(CuraApplication.getInstance().exec_()) else: _crash_handler.show() else: application = QApplication(sys.argv) application.removePostedEvents(None) _crash_handler = CrashHandler(hook_type, value, traceback, has_started) # This means the QtApplication could be created and so the splash screen. Then Cura closes it if CuraApplication.splash is not None: CuraApplication.splash.close() _crash_handler.early_crash_dialog.show() sys.exit(application.exec_())
def log(self, log_type: str, message: str) -> None: """Log the message to the sentry hub as a breadcrumb :param log_type: "e" (error), "i"(info), "d"(debug), "w"(warning) or "c"(critical) (can postfix with "_once") :param message: String containing message to be logged """ level = self._translateLogType(log_type) message = CrashHandler.pruneSensitiveData(message) if level is None: if message not in self._show_once: level = self._translateLogType(log_type[0]) if level is not None: self._show_once.add(message) add_breadcrumb(level = level, message = message) else: add_breadcrumb(level = level, message = message)
def exceptHook(hook_type, value, traceback): from cura.CrashHandler import CrashHandler from cura.CuraApplication import CuraApplication has_started = False if CuraApplication.Created: has_started = CuraApplication.getInstance().started # # When the exception hook is triggered, the QApplication may not have been initialized yet. In this case, we don't # have an QApplication to handle the event loop, which is required by the Crash Dialog. # The flag "CuraApplication.Created" is set to True when CuraApplication finishes its constructor call. # # Before the "started" flag is set to True, the Qt event loop has not started yet. The event loop is a blocking # call to the QApplication.exec_(). In this case, we need to: # 1. Remove all scheduled events so no more unnecessary events will be processed, such as loading the main dialog, # loading the machine, etc. # 2. Start the Qt event loop with exec_() and show the Crash Dialog. # # If the application has finished its initialization and was running fine, and then something causes a crash, # we run the old routine to show the Crash Dialog. # from PyQt5.Qt import QApplication if CuraApplication.Created: _crash_handler = CrashHandler(hook_type, value, traceback, has_started) if CuraApplication.splash is not None: CuraApplication.splash.close() if not has_started: CuraApplication.getInstance().removePostedEvents(None) _crash_handler.early_crash_dialog.show() sys.exit(CuraApplication.getInstance().exec_()) else: _crash_handler.show() else: application = QApplication(sys.argv) application.removePostedEvents(None) _crash_handler = CrashHandler(hook_type, value, traceback, has_started) # This means the QtApplication could be created and so the splash screen. Then Cura closes it if CuraApplication.splash is not None: CuraApplication.splash.close() _crash_handler.early_crash_dialog.show() sys.exit(application.exec_())
def exceptHook(hook_type, value, traceback): from cura.CrashHandler import CrashHandler _crash_handler = CrashHandler(hook_type, value, traceback) _crash_handler.show()
def exceptHook(hook_type, value, traceback): from cura.CrashHandler import CrashHandler _crash_handler = CrashHandler(hook_type, value, traceback) _crash_handler.show()