Skip to content

Instantly share code, notes, and snippets.

@vesln
Created December 29, 2011 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vesln/1532952 to your computer and use it in GitHub Desktop.
Save vesln/1532952 to your computer and use it in GitHub Desktop.
Logme with env var
/**
* Dependencies.
*/
var log = require('./log');
log.debug('This will not be logged.');
log.critical('Logged.');
/**
* 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