logger: logger.log becomes the completeness receipt

Its only content was the redundant announce line — the useful shutdown
marker was written AFTER the final drain, so it reached serial and the
ring but never a file, and a truncated boot could only be inferred from
what was missing. The marker now enters the ring BEFORE the drain, so
the drain carries it into logger.log: a directory whose logger.log ends
with 'shutting down; final flush' is complete through shutdown; one
without it was cut early. The sequence-count epilogue stays serial-only,
after the drain, by design.
This commit is contained in:
Daniel Samson
2026-07-21 20:05:13 +01:00
parent eb6e8edafe
commit f0611ef8ac
20 changed files with 484 additions and 1 deletions
+6 -1
View File
@@ -112,9 +112,14 @@ fn onNotification(badge: u64) void {
}
fn onTerminate() void {
// Final drain: everything still in the ring, then close (= flush) all files.
// The completeness receipt FIRST: this record enters the ring before the
// final drain, so the drain carries it into logger.log — a directory whose
// logger.log ends with this marker is complete through shutdown; one that
// doesn't was cut early and may be missing tails.
_ = system.write("logger: shutting down; final flush\n");
drain();
closeAll();
// Serial-only epilogue (after the drain, so it reaches no file — by design).
var line: [96]u8 = undefined;
_ = system.write(std.fmt.bufPrint(&line, "logger: flushed through sequence {d}\n", .{next_expected_sequence}) catch return);
}