Last active
December 11, 2015 05:08
-
-
Save sjungling/4549846 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Replace YOUR_ORG with your global namespace | |
| window.YOUR_ORG = | |
| debug: false | |
| log: (msg, type, context) -> | |
| message = undefined | |
| if window.console and @debug | |
| if typeof msg is "string" and context isnt undefined | |
| message = "(" + (new Date().getTime()) + ") " + context + ": " + msg | |
| else | |
| message = msg | |
| if type is "error" | |
| console.error message | |
| else if type is "warn" | |
| console.warn message | |
| else | |
| console.log message |
This file contains hidden or 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
| /* Replace YOUR_ORG with your global namespace */ | |
| window.YOUR_ORG = { | |
| debug: false, | |
| log: function(msg, type, context) { | |
| var message; | |
| message = void 0; | |
| if (window.console && this.debug) { | |
| if (typeof msg === "string" && context !== void 0) { | |
| message = "(" + (new Date().getTime()) + ") " + context + ": " + msg; | |
| } else { | |
| message = msg; | |
| } | |
| if (type === "error") { | |
| return console.error(message); | |
| } else if (type === "warn") { | |
| return console.warn(message); | |
| } else { | |
| return console.log(message); | |
| } | |
| } | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment