From 0e60860cf0bf0349344d077e2ad6bb7e188b7d43 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Wed, 1 Jul 2026 09:44:11 +0200 Subject: [PATCH] feat: periodically checkpoint server/sud logs to disk Both loggers previously only wrote their JSON log on their end trigger (shutdown / Stop-or-DONE), losing the whole session/run's data on a hard crash or power loss. Add a log_interval (config.json, default 300s) that rewrites the same file whole every N seconds in between. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01TvgC7oy9MxaA4ZQxXqkNdS --- README.md | 18 ++++++++++-------- config-real.json.tpl | 1 + config-sim.json.tpl | 1 + server/brewpi.py | 17 +++++++++++++---- tasks/server_log.py | 11 ++++++++++- tasks/sud_log.py | 5 +++-- 6 files changed, 38 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 06a043b..0f2aa7b 100644 --- a/README.md +++ b/README.md @@ -689,20 +689,22 @@ Both loggers record the same six signals the GUI's Automatic tab plots live (`temp_ist`/`temp_soll`, `rate_ist`/`rate_soll`, `power_set`/`power_eff`), each sample with both simulated-elapsed-seconds and a real wall-clock timestamp, plus any plant-param changes along the way (see -`apply_plant_params()`) - written as JSON via `write()`, whole and only -once, never partially mid-run. +`apply_plant_params()`) - written as JSON via `write()`, always the whole +accumulated sample list rewritten to the same file, never appended. `tasks/server_log.py`'s `ServerLogTask` records continuously for the whole server session, regardless of Sud state - useful for verifying controller and heater behaviour outside of a scheduled brew. It starts on construction -and is written to `logs/log_T