If your Node.js code is littered with console.log statements are you inviting performance issues? Is it worth debug/production toggling this on/off? I realized logging is import
As said above, the console.log
is asynchronous and non-blocking, so it would not slow your application too much except one tick for the function invocation.
But it is a good habit to use some module to turn some logs of certain level off when deploy it in production instead of using console.log directly. There have been several good ones as @Alfred listed.
The Nodejs official blog posted an article suggesting use JSON format for logging, check it out at Service logging in JSON with Bunyan, and Bunyan for nodejs is really worth trying.