(p: string)
| 69 | } |
| 70 | |
| 71 | function setLogPath(p: string): void { |
| 72 | if (p === logPath) return // nothing to do |
| 73 | |
| 74 | logPath = p |
| 75 | mkdirSync(dirname(p), { recursive: true }) |
| 76 | |
| 77 | // ────────────────────────────────────────────────────────────── |
| 78 | // pino.destination(..) → SonicBoom stream, no worker thread |
| 79 | // ────────────────────────────────────────────────────────────── |
| 80 | const fileStream = pino.destination({ |
| 81 | dest: p, // absolute or relative file path |
| 82 | mkdir: true, // create parent dirs if they don’t exist |
| 83 | sync: true, // set true if you *must* block on every write |
| 84 | }) |
| 85 | |
| 86 | pinoLogger = pino( |
| 87 | { |
| 88 | level: 'debug', |
| 89 | formatters: { |
| 90 | level: (label) => ({ level: label.toUpperCase() }), |
| 91 | }, |
| 92 | timestamp: () => `,"timestamp":"${new Date().toISOString()}"`, |
| 93 | }, |
| 94 | fileStream, // <-- no worker thread involved |
| 95 | ) |
| 96 | } |
| 97 | |
| 98 | export function clearLogFile(): void { |
| 99 | const projectRoot = getProjectRoot() |
no outgoing calls
no test coverage detected