Skip to content

Instantly share code, notes, and snippets.

@GirlBossRush
Created December 27, 2013 05:31
Show Gist options
  • Save GirlBossRush/8142935 to your computer and use it in GitHub Desktop.
Save GirlBossRush/8142935 to your computer and use it in GitHub Desktop.
Logger = {
dispatch: function dispatch () {
if (arguments.length > 1) {
var args = Array.prototype.slice.call(arguments, 0),
pipe = args.shift();
args[0] = '[' + args[0] + ']';
args.splice(0, 0, ('[' + new Date() + ']'));
console[pipe].apply(console, args);
} else {
console.error('[' + new Date() + ']', '[Logger]', 'Arguments not given.');
}
},
log: function log (argument) {
var args = Array.prototype.slice.call(arguments, 0);
args.splice(0, 0, arguments.callee.name);
this.dispatch.apply(null, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment