Convert log to string for fallback server

This commit is contained in:
Joe Knapper 2026-07-08 14:05:01 +01:00 committed by Julian Stirling
parent ad3b579829
commit 7b7c5f932e

View file

@ -2,6 +2,7 @@
from __future__ import annotations
import json
import logging
import os
from argparse import Namespace
@ -150,7 +151,8 @@ def serve_from_cli(argv: Optional[list[str]] = None) -> None:
print(f"Error: {e}") # noqa: T201
print("Starting fallback server.") # noqa: T201
try:
log_history = OFM_HANDLER.log_history
# The log is a list of dicts, fallback server expects a string
log_history = json.dumps(OFM_HANDLER.log_history, indent=2)
except BaseException:
# If log history fails for any reason carry on.
log_history = None