code: def exception_logger(exc_type, exc_value, exc_traceback):
      
      if not issubclass(exc_type, KeyboardInterrupt):  # do not log Ctrl-C
          _log.critical(
              "Uncaught exception:",
              exc_info=(exc_type, exc_value, exc_traceback)
          )
      sys.__excepthook__(exc_type, exc_value, exc_traceback)
docs: Log unhandled exceptions