()
| 81 | } |
| 82 | |
| 83 | private getLogStream(): fs.WriteStream { |
| 84 | if (this.logStream) return this.logStream |
| 85 | |
| 86 | const filePath = this.getLogFilePath() |
| 87 | const isNewOrEmptyFile = !fs.existsSync(filePath) || fs.statSync(filePath).size === 0 |
| 88 | this.logStream = fs.createWriteStream(filePath, { flags: 'a', encoding: 'utf-8' }) |
| 89 | if (isNewOrEmptyFile) { |
| 90 | this.logStream.write(`Local Path: ${filePath.replace(/ /g, '\\ ')}\n\n`) |
| 91 | } |
| 92 | |
| 93 | return this.logStream |
| 94 | } |
| 95 | |
| 96 | private writeLog(level: LogLevel, category: string, message: string, data?: unknown): void { |
| 97 | const timestamp = new Date().toISOString() |
no test coverage detected