node.js - Node - Override function in all files except one -


i've been looking around @ somehow disabling console.log in application while running unit tests, , found answers can override console.log this:

console.log = function(){}; 

i tried putting in app.js, , overrides console.log when i'm running app, not when running unit tests, tried adding test file, overrides mocha / chai's console.log, , blank screen.

is there way override console.log in files except 1 running?

what want instead use logging library loggly or bunyan. these pass message want log client , can output logs based on environment in. in case want log during production not during testing (kindof odd, whatever). set process.node_env dev or prod accordingly , logger take care of logging you. here's overview of loggers.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -