feat: mirror server text log to a fixed brewpi.latest.log

Same principle as log_latest.json/log_latest_sud.json: a tail-style
consumer can point at one unchanging path instead of tracking the
current run's timestamped filename.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GpePKZiEZWbGo9HrfuML6U
This commit is contained in:
2026-07-02 16:38:32 +02:00
co-authored by Claude Sonnet 5
parent 1bcabb0ccc
commit 97a8ad5bc3
+8 -2
View File
@@ -66,8 +66,14 @@ if __name__ == '__main__':
os.makedirs(args.logdir, exist_ok=True) os.makedirs(args.logdir, exist_ok=True)
log_path = f"{args.logdir}/brewpi.{time.strftime("%Y%m%d%H%M%S", time.localtime())}.log" log_path = f"{args.logdir}/brewpi.{time.strftime("%Y%m%d%H%M%S", time.localtime())}.log"
log_file = open(log_path, "a", buffering=1) log_file = open(log_path, "a", buffering=1)
sys.stdout = Tee(sys.stdout, log_file) # Fixed (no-date) name written alongside the dated one - always
sys.stderr = Tee(sys.stderr, log_file) # truncated and re-mirrored, so a tail-style consumer can point at one
# unchanging path instead of tracking this run's own timestamped
# filename (same principle as ServerLogTask/SudLogTask's log_latest*.json).
latest_log_path = f"{args.logdir}/brewpi.latest.log"
latest_log_file = open(latest_log_path, "w", buffering=1)
sys.stdout = Tee(sys.stdout, log_file, latest_log_file)
sys.stderr = Tee(sys.stderr, log_file, latest_log_file)
print("Logging to {}".format(log_path)) print("Logging to {}".format(log_path))
config = json.load(open(args.config)) config = json.load(open(args.config))