deno_std
deno_std copied to clipboard
suggestion: rework `std/log` to use Streams API
std/log is the last of the sub-modules that uses the deprecated Writer (i.e. Deno.Writer) interface. It should use WritableStream instead.
Related:
- https://github.com/denoland/deno/pull/21465
- https://github.com/denoland/deno_std/issues/1986
I'm having a go at this.
It looks like moving to the Streams API causes some of the handler methods to become async, this might introduce complexities around what happens if a log comes in mid flush as operations are no longer atomic, especially so for the RotatingFileHandler.
Would you mind if I submit a WIP PR to see if I'm on the right track? I might need to implement a queue to buffer the buffer.
That's great to hear! I've looked at your PR, and it seems like you're on the right track for now. Please let us know if you have any questions.
An alternative was provided in #4021 that used Deno.FsFile.writeSync() and removed the dependency on Deno.Writer. Thank you for solving this, @syhol!