You might want to move away from console.log and use a logging library such as winston, but it depends on how big your project is and how much flexibility you want.
By the way console.log = function() {}; will work, it just depends on whether you want some logging to work (as probably is the case, you might want to see errors) or not.
I've tested the previous by creating the following setup:
file 1.js
console.log = function() {};
require('./2');
file 2.js
// you will not see anything
console.log(2);
If you will decide to use it you will then be able to set logging levels , which will help you to not show verbose logs in a production environment.
For example:
var winston = require('winston');
winston.level = process.env.NODE_ENV == 'production' ? 'error' : 'debug';
// will show 'ERROR' in production logs
winston.error('ERROR')
// will show 'called test function' in an environment
// different from production
winston.debug('called test function')