(path: string)
| 22 | const fileStream = openFileSink(FILE_PATH); |
| 23 | |
| 24 | function openFileSink(path: string): WriteStream | null { |
| 25 | try { |
| 26 | mkdirSync(dirname(path), { recursive: true }); |
| 27 | const s = createWriteStream(path, { flags: 'a' }); |
| 28 | s.on('error', () => { /* swallow — never take down spawn lifecycle */ }); |
| 29 | return s; |
| 30 | } catch { |
| 31 | return null; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | function write(level: Level, msg: string, fields: Record<string, unknown>, toConsole: boolean): void { |
| 36 | const record: Record<string, unknown> = { |