How to disable console log in NodeJS production

console.log is great! Everyone knows that. What’s not that great is that if you let it be in your source code you will get flooded logs on your NodeJS production server. Not that great. But don’t stress my friend. There is a easy fix for this.

Just put this at the top of your server.js or equivalent after the require statements

// Remove console log in production mode
if(process.env.NODE_ENV == "production")
{
	console.log = function(){};	
}