Skip to content

Instantly share code, notes, and snippets.

@markcode
Created December 18, 2013 23:28
Show Gist options
  • Save markcode/8031673 to your computer and use it in GitHub Desktop.
Save markcode/8031673 to your computer and use it in GitHub Desktop.
Logging function for: quiet, benchmarking, debug and dumping.
// logging, dump, function. Can set: gconfig['loggin'] = 'quiet' || 'benchmarking' || 'debug'
var log = function(txt, benchmarking, dump) {
if ( dump != undefined ) {
console.log(txt + ' >> ' + require('util').inspect(dump, true, 99, true));
} else if ( gconfig['loging'] === 'benchmarking' ) {
if ( benchmarking === true ) {
console.log(txt);
}
} else if ( gconfig['loging'] === 'debug' ) {
console.log(txt);
} else if ( gconfig['loging'] === 'quiet' ) {
// only if throw errors.
}
};
var log = function(txt, benchmarking, dump) { if ( dump != undefined ) { console.log(txt + ' >> ' + require('util').inspect(dump, true, 99, true)); } else if ( gconfig['loging'] === 'benchmarking' ) { if ( benchmarking === true ) { console.log(txt); } } else if ( gconfig['loging'] === 'debug' ) { console.log(txt); } else if ( gconfig['loging'] === 'quiet' ) { } };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment