Skip to content

Commit d1f9829

Browse files
committed
Capture debug-level teardown diagnostics in the log file
Filtering the file sink at warning silently disabled a dozen logger.debug calls written specifically to diagnose teardown races in the TUI and exec runners. A file has no screen to corrupt, so drop the floor to debug and let those diagnostics reach it.
1 parent 40e0f8b commit d1f9829

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/logging/sink.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import { SETTINGS_DIR_NAME } from "../branding.js";
88

99
// Matches LogTape's Sink shape structurally (see @logtape/logtape's
1010
// sink.d.ts); not imported directly since only @intx/log is a declared
11-
// dependency here.
11+
// dependency here. The real type is strictly wider than this — if LogTape
12+
// ever renames or narrows one of these fields, nothing here will catch the
13+
// drift, so keep this in sync by hand if @intx/log's pinned version moves.
1214
type LogRecord = {
1315
readonly category: readonly string[];
1416
readonly level: string;
@@ -54,9 +56,14 @@ export function installFileLogSink(path: string = corbitsLogFilePath()): void {
5456
appendFileSync(path, formatRecord(record));
5557
},
5658
},
59+
// "debug" (not "warning"): a file has no screen to corrupt, and several
60+
// teardown-race diagnostics (e.g. src/tui/runner.ts, src/exec/runner.ts)
61+
// are logger.debug calls that exist specifically to be readable here
62+
// after the fact. Filtering them out at the sink would silently disable
63+
// the diagnostics the file exists to capture.
5764
loggers: [
5865
{ category: ["logtape", "meta"], lowestLevel: "warning", sinks: ["file"] },
59-
{ category: [], lowestLevel: "warning", sinks: ["file"] },
66+
{ category: [], lowestLevel: "debug", sinks: ["file"] },
6067
],
6168
});
6269
}

0 commit comments

Comments
 (0)