-
-
Save egonelbre/c7117b98cea93dca3496 to your computer and use it in GitHub Desktop.
This file contains 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
Logger = { | |
ensure: function(context){ | |
var self = this; | |
var prefix = '[' + context + '] '; | |
this[context] = function(){ | |
var args = Array.prototype.slice.call(arguments); | |
args.unshift(prefix); | |
console.log.apply(console, args); | |
} | |
} | |
}; | |
InvokeLogger = Context(function(log){ | |
Logger = log; | |
Logger.info("test"); | |
Logger.info("second"); | |
}, { | |
Logger: { | |
info: function(message){ | |
this.ensure("info"); | |
this.info("[ROLE]", message); | |
} | |
} | |
}); | |
InvokeLogger(Logger); | |
Logger.info("testing"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment