Difference in blocking between sys.log() and console.log() and console.error()?
- Is any one of sys.log(), console.log(), console.error() blocking? (var sys = require("sys");)
- How is sys.log() d开发者_Go百科ifferent from console.log();
console.error
is blocking (it calls sync write in writeError).
console.log
is non-blocking = process.stdout.write(util.format.apply(this, arguments) + '\n');
sys.log
== util.log
== puts(timestamp() + ' - ' + msg.toString());
(non-blocking)
From Firebug Wiki:
console.log writes a message to the console. You may pass as many arguments as you'd like, and they will be joined together in a space-delimited line.
console.error writes a message to the console with the visual "error" icon and color coding and a hyperlink to the line where it was called.
AFAIK they are not blocking.
sys.log is not native in the browsers I use. Maybe you can provide more info on that.
UPDATE: just noticed your node.js tag... Anyhow, I still don't think any of them is blocking.
精彩评论