I use AWS and I want write all errors to stderr
using console.err()
. stderr
is caught by AWS Cloud Watch and logged. I don't want blocking the event loop.
Is console.err()
in Node.js implementation asynchronous?
It depends on the OS and of where stderr
is "going".
From the Node.js documentation:
process.stdout
andprocess.stderr
differ from other Node.js streams in important ways:
They are used internally by
console.log()
andconsole.error()
, respectively.Writes may be synchronous depending on what the stream is connected to and whether the system is Windows or POSIX:
- Files: synchronous on Windows and POSIX
- TTYs (Terminals): asynchronous on Windows, synchronous on POSIX
- Pipes (and sockets): synchronous on Windows, asynchronous on POSIX