impr: log uncaught exceptions

This commit is contained in:
283375 2023-10-21 14:00:27 +08:00
parent 55ef2ba3bb
commit d918032b9c
Signed by: 283375
SSH Key Fingerprint: SHA256:UcX0qg6ZOSDOeieKPGokA5h7soykG61nz2uxuQgVLSk

View File

@ -23,6 +23,19 @@ rootLoggerFormatter = logging.Formatter(
)
def handle_exception(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt):
sys.__excepthook__(exc_type, exc_value, exc_traceback)
return
rootLogger.critical(
"Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback)
)
sys.excepthook = handle_exception
if __name__ == "__main__":
QCoreApplication.setApplicationName("Arcaea Offline")