Created
December 29, 2011 08:33
-
-
Save vesln/1532952 to your computer and use it in GitHub Desktop.
Logme with env var
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Dependencies. | |
*/ | |
var log = require('./log'); | |
log.debug('This will not be logged.'); | |
log.critical('Logged.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Dependencies. | |
*/ | |
var Logme = require('logme').Logme; | |
/** | |
* Logme configurations. | |
* | |
* @type {Object} | |
*/ | |
var config = { | |
level: 'debug' | |
}; | |
/** | |
* Checks if the node env var is production and if so | |
* sets the log level to critical. | |
*/ | |
if (process.env.NODE_ENV === 'production') { | |
config.level = 'critical'; | |
} | |
/** | |
* Exporting the lib. | |
*/ | |
module.exports = new Logme(config); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment