feat: always write a fixed-name copy of server/sud logs, use .json for sud logs

Alongside the dated log files, ServerLogTask/SudLogTask now also write
(and overwrite) a fixed-name copy on every write() - logs/log_latest.json
and logs/log_latest_sud.json - so a dashboard/tail-style consumer can
point at one unchanging path instead of tracking the current run's
timestamped filename.

Also switches SudLogTask's own dated/latest filenames from .log to .json,
matching what they've always actually contained. This incidentally fixes
utils/analyze_log.py's two-argument CLI form, which already assumed a
.json extension for sud logs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFDeoTKBDkXRhPfnyDEoBt
This commit is contained in:
2026-07-01 20:23:16 +02:00
co-authored by Claude Sonnet 5
parent da7e954b7c
commit a495e758fd
3 changed files with 24 additions and 6 deletions
+9 -2
View File
@@ -11,7 +11,7 @@ class SudLogTask(ServerLogTask):
"""Records temp/power samples for a single Sud run - same sample format
as ServerLogTask, but only while a run is active: recording starts on
Play and is written out on Stop (or natural completion), to
logs/log_{date_time}_{sud_name}.log. A Pause/resume doesn't start a new
logs/log_{date_time}_{sud_name}.json. A Pause/resume doesn't start a new
file - only a fresh Play (from IDLE/DONE) does."""
def __init__(self, tc: APid, heater: AHeater, heater_task, sud, interval, path='./logs', config=None, dt=None, log_interval=None, sim_warp_factor=None):
@@ -26,7 +26,14 @@ class SudLogTask(ServerLogTask):
def _filename(self):
name_part = _safe_filename_part(self.sud.name or 'Sud')
return 'log_{}_{}.log'.format(self._run_id, name_part)
return 'log_{}_{}.json'.format(self._run_id, name_part)
def _latest_filename(self):
# Fixed regardless of which schedule is running, unlike _filename()
# above - a dashboard/tail-style consumer can point at one
# unchanging path across different Suds, not just different runs
# of the same one.
return 'log_latest_sud.json'
def _log_name(self):
return self.sud.name