fix: error during logging shutdown

This commit is contained in:
Matthias
2025-06-09 19:12:57 +02:00
parent 03a46ec784
commit 6ff26b075e

View File

@@ -21,7 +21,9 @@ class FtRichHandler(Handler):
msg = self.format(record)
# Format log message
log_time = Text(
datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3],
datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3]
if record.created
else "N/A",
)
name = Text(record.name, style="violet")
log_level = Text(record.levelname, style=f"logging.level.{record.levelname.lower()}")
@@ -40,5 +42,8 @@ class FtRichHandler(Handler):
except RecursionError:
raise
except ImportError:
# Error when shutting down the console...
pass
except Exception:
self.handleError(record)