What exactly is the difference between the util.error([...]) and console.error([...])?
In both of the methods it prints to stderr.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Documentation
util.error
util.debug
console.error
console.log
Conclusion
According to is node.js' console.log asynchronous? the console.log is asynchronous(node>=0.6), therefore also console.error. But util.error will block the process and output to stderr, according to the documentation above.