(filePath: string)
| 17 | let lastEnsuredDir: string | null = null; |
| 18 | |
| 19 | function ensureDir(filePath: string): void { |
| 20 | const dir = path.dirname(filePath); |
| 21 | if (dir === lastEnsuredDir) return; |
| 22 | try { |
| 23 | fs.mkdirSync(dir, { recursive: true }); |
| 24 | lastEnsuredDir = dir; |
| 25 | } catch { |
| 26 | // Intentional: logging must never throw. If mkdir fails we still |
| 27 | // try the append; failure there is also swallowed. |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | function flush(): void { |
| 32 | if (flushTimer) { |