(chunk: string, patterns: RegExp[])
| 13 | } |
| 14 | |
| 15 | function redactChunk(chunk: string, patterns: RegExp[]): string { |
| 16 | if (patterns.length === 0) return chunk; |
| 17 | let output = chunk; |
| 18 | for (const pattern of patterns) { |
| 19 | output = output.replace(pattern, '[REDACTED]'); |
| 20 | } |
| 21 | return output; |
| 22 | } |
| 23 | |
| 24 | type LineWriter = { onChunk: (chunk: string) => void; flush: () => void }; |
| 25 |