Log to a file and make it visible via the API

This commit is contained in:
Richard Bowman 2023-12-13 01:54:42 +00:00
parent 3059683186
commit 3b2fd29fb0
2 changed files with 43 additions and 4 deletions

View file

@ -14,11 +14,9 @@ from .things.camera_stage_mapping import CameraStageMapper
from .things.system_control import SystemControlThing
from .things.settings_manager import SettingsManager
from .serve_static_files import add_static_files
from .logging import configure_logging, retrieve_log
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
root_logger.info("This is a message from OFM server via root_logger")
logging.info("This is another message via logging.info")
configure_logging()
thing_server = ThingServer()
thing_server.add_thing(StreamingPiCamera2(), "/camera/")
@ -32,6 +30,9 @@ try:
except RuntimeError:
print("Failed to add static files - you will have to do without them!")
# Add an endpoint to get the log
thing_server.app.get("/log/")(retrieve_log)
app = thing_server.app