def emit(self, record): try: return super().emit(record) finally: if record.levelno > logging.WARNING: try: from editxt import app app.open_error_log(set_current=False) except Exception: log.warn("cannot open error log", exc_info=True)