Skip to content

Commit

Permalink
fix(logger): not flushing all records to file (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hieuzest authored Dec 11, 2024
1 parent c05c426 commit 9650d47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/logger/src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down

0 comments on commit 9650d47

Please sign in to comment.