Serve logfile and logs for UI seperately

This commit is contained in:
Julian Stirling 2025-04-07 23:38:09 +01:00
parent 70d9e2f758
commit 3a47151694
4 changed files with 24 additions and 8 deletions

View file

@ -6,7 +6,7 @@ from labthings_fastapi.server import cli, ThingServer
import uvicorn
from .serve_static_files import add_static_files
from .legacy_api import add_v2_endpoints
from ..logging import configure_logging, retrieve_log
from ..logging import configure_logging, retrieve_log, retrieve_log_from_file
def customise_server(server: ThingServer):
@ -18,8 +18,9 @@ def customise_server(server: ThingServer):
except RuntimeError:
print("Failed to add static files - you will have to do without them!")
# Add an endpoint to get the log
# Add an endpoint to get the logs - (directly calling the FastAPI decorator)
server.app.get("/log/")(retrieve_log)
server.app.get("/logfile/")(retrieve_log_from_file)
def serve_from_cli(argv: Optional[list[str]] = None):