diff --git a/src/backend/logger/logger.ts b/src/backend/logger/logger.ts index db4bbfdbef..00729860dd 100644 --- a/src/backend/logger/logger.ts +++ b/src/backend/logger/logger.ts @@ -360,7 +360,7 @@ const logsWriters: Record = {} class LogWriter { gameInfo: GameInfo - queue: string[] | undefined + queue: string[] initialized: boolean timeoutId: NodeJS.Timeout | undefined filePath: string @@ -369,11 +369,10 @@ class LogWriter { this.gameInfo = gameInfo this.initialized = false this.filePath = lastPlayLogFileLocation(gameInfo.app_name) + this.queue = [] } logMessage(message: string) { - this.queue ??= [] - // push messages to append to the log this.queue.push(message) @@ -465,8 +464,7 @@ class LogWriter { } export function appendGameLog(gameInfo: GameInfo, message: string) { - logsWriters[gameInfo.app_name] ??= new LogWriter(gameInfo) - logsWriters[gameInfo.app_name].logMessage(message) + logsWriters[gameInfo.app_name]?.logMessage(message) } export function initGameLog(gameInfo: GameInfo) {