Skip to content

Instantly share code, notes, and snippets.

@yongzhihuang
Last active November 25, 2015 17:28
Show Gist options
  • Save yongzhihuang/a890ca78f369fad4ce3d to your computer and use it in GitHub Desktop.
Save yongzhihuang/a890ca78f369fad4ce3d to your computer and use it in GitHub Desktop.
Debug mode console log - credit to an kiddy script which I do not have the URL for
var debug = false;
var oldlog = console.log;
console.log1 = function() {
if (debug) {
oldlog.apply(this, Array.prototype.slice.call(arguments));
}
};
//usage
debug = true;
console.log1('this message will show up');
debug = false;
console.log1('this message will not show up');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment