MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / getLogStream

Method getLogStream

packages/node-runtime/src/ai/ai-logger.ts:83–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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()

Callers 1

writeLogMethod · 0.95

Calls 2

getLogFilePathMethod · 0.95
writeMethod · 0.65

Tested by

no test coverage detected