From cd80ebfce0eabdb04309ea0e964108e79729b978 Mon Sep 17 00:00:00 2001 From: Hieuzest Date: Sat, 7 Dec 2024 17:34:05 +0800 Subject: [PATCH] fix(logger): not flushing all records to file --- plugins/logger/src/file.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/logger/src/file.ts b/plugins/logger/src/file.ts index b71be7e8..287f144a 100644 --- a/plugins/logger/src/file.ts +++ b/plugins/logger/src/file.ts @@ -23,10 +23,10 @@ export class FileWriter { if (!this.temp.length) return this.task = this.task.then(async (handle) => { const content = Buffer.from(this.temp.map((record) => JSON.stringify(record) + '\n').join('')) - await handle.write(content) this.data.push(...this.temp) - this.size += content.byteLength this.temp = [] + await handle.write(content) + this.size += content.byteLength return handle }) }