I'm using simple runtime logging a lot in my Node.JS Cloud Functions
console.log('I am a log entry!');
Is console.log in Cloud Functions asynchronous in its nature?
As @slebetman stated, In the original implementation of node.js it was asynchronous. However, console.log()
was made synchronous some time in version 4 (2015). The reason for it was to avoid losing logs when a node process crashes. Making it synchronous ensures that all the text of the log gets printed before the process dies.
Note: However, 3rd party logging libraries like Winston or syslog may still be asynchronous. Some may be configured to be sync or async. The built-in console.log()
is synchronous.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.