#How to continue writing to file?

1 messages · Page 1 of 1 (latest)

vocal moat
#

Hello, I'm trying to log everything to a file, but when I start a new writer (FileSink), old content gets replaced with new one when I flush content.
Code:

const file = Bun.file(
      process.cwd() +
        `/logs/${
          (date[1].length == 1 ? "0" + date[1] : date[1]) +
          "." +
          date[0] +
          "." +
          date[2].slice(0, 4)
        }.log`
    );
this.writer = file.writer();
this.writer.start();
this.writer.write(`${this.getTime()} | Logger started.\n`);
// Do some other stuff
this.writer.flush();
opaque chasm
#

comment out the line and see if it's resolved