(filePath: string, streamName: 'stdout' | 'stderr', chunk: unknown)
| 1280 | } |
| 1281 | |
| 1282 | function writeLogChunk(filePath: string, streamName: 'stdout' | 'stderr', chunk: unknown): void { |
| 1283 | const text = Buffer.isBuffer(chunk) ? chunk.toString('utf8') : String(chunk); |
| 1284 | if (streamName === 'stderr') { |
| 1285 | process.stderr.write(text); |
| 1286 | } else { |
| 1287 | process.stdout.write(text); |
| 1288 | } |
| 1289 | fs.appendFile(filePath, text, () => {}); |
| 1290 | } |
| 1291 | |
| 1292 | function writeLogLine(filePath: string, streamName: 'stdout' | 'stderr', line: string): void { |
| 1293 | writeLogChunk(filePath, streamName, `${new Date().toISOString()} ${line}\n`); |
no test coverage detected