Unverified Commit 23813a77 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

[mcp] logging file should be reset for each session (#84425)

parent 43aef82b
......@@ -8,6 +8,7 @@ export interface LogEntry {
message: string
}
// Logging server and browser logs to a file
export class FileLogger {
private logFilePath: string = ''
private isInitialized: boolean = false
......@@ -29,12 +30,10 @@ export class FileLogger {
}
try {
// Create the log file if it doesn't exist
if (!fs.existsSync(this.logFilePath)) {
// ensure the directory exists
fs.mkdirSync(path.dirname(this.logFilePath), { recursive: true })
fs.writeFileSync(this.logFilePath, '')
}
// Clean up the log file on each initialization
// ensure the directory exists
fs.mkdirSync(path.dirname(this.logFilePath), { recursive: true })
fs.writeFileSync(this.logFilePath, '')
this.isInitialized = true
} catch (error) {
console.error(error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment