feat: experiment log stream, to file and UI

Adds a few new logging utility classes. One to save to files with a date, one to support optional fields in formats, last to filter partial log messages.

ref: N25B-401
This commit is contained in:
Twirre Meulenbelt
2026-01-15 17:07:49 +01:00
parent a9df9208bc
commit 4cda4e5e70
12 changed files with 479 additions and 10 deletions

View File

@@ -0,0 +1,18 @@
from unittest.mock import MagicMock, patch
from control_backend.logging.dated_file_handler import DatedFileHandler
@patch("control_backend.logging.file_handler.DatedFileHandler._open")
def test_reset(open_):
stream = MagicMock()
open_.return_value = stream
# A file should be opened when the logger is created
handler = DatedFileHandler(prefix="anything")
assert open_.call_count == 1
# Upon reset, the current file should be closed, and a new one should be opened
handler.do_rollover()
assert stream.close.call_count == 1
assert open_.call_count == 2