doc: add a note on console stream behavior

Many user reported issues show poor awareness of the
nature of console streams. explicitly document that.

PR-URL: https://github.com/nodejs/node/pull/55616
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Gireesh Punathil 2024-11-02 18:07:09 +05:30 committed by GitHub
parent ba8fc73131
commit 44afd67831
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,7 +19,11 @@ The module exports two specific components:
_**Warning**_: The global console object's methods are neither consistently
synchronous like the browser APIs they resemble, nor are they consistently
asynchronous like all other Node.js streams. See the [note on process I/O][] for
asynchronous like all other Node.js streams. Programs that desire to depend
on the synchronous / asynchronous behavior of the console functions should
first figure out the nature of console's backing stream. This is because the
stream is dependent on the underlying platform and standard stream
configuration of the current process. See the [note on process I/O][] for
more information.
Example using the global `console`: