Created
February 8, 2013 18:29
-
-
Save linuxsable/4740952 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
| function () { | |
| var a = "all"; | |
| R.logger = { | |
| _originalLog: _.isUndefined(window.console) ? R.doNothing : console.log, | |
| _originalError: _.isUndefined(window.console) ? R.doNothing : console.error, | |
| logQueue: [], | |
| _log: function (a, b, c) { | |
| a[0] = "[" + Date() + "] " + a[0], this.logQueue.unshift(a.join(" ")), this.logQueue.length >= 10 && this.logQueue.pop(); | |
| if (!c) return; | |
| try { | |
| jQuery.browser.msie ? b(a[0]) : b.apply(console, a) | |
| } catch (d) {} | |
| }, | |
| log: function () { | |
| this._log(_.toArray(arguments), this._originalLog, a === "all") | |
| }, | |
| error: function () { | |
| this. | |
| _log(_.toArray(arguments), this._originalError, a !== "none") | |
| }, | |
| verbosity: function (b) { | |
| if (_.isUndefined(b)) return a; | |
| b === "all" || b === "errors" || b === "none" ? a = b : this._originalError("Invalid argument passed to R.logger.verbosity()") | |
| }, | |
| ensureConsole: function () { | |
| var a = _.bind(R.logger.log, R.logger), | |
| b = _.bind(R.logger.error, R.logger); | |
| _.isUndefined(window.console) && (window.console = {}), _.defaults(console, { | |
| log: a, | |
| info: a, | |
| warn: b, | |
| error: b, | |
| exception: b, | |
| assert: function (a, b) { | |
| a || this. | |
| error("Assertion failed: " + b) | |
| }, | |
| dir: R.doNothing, | |
| time: R.doNothing, | |
| timeEnd: R.doNothing, | |
| trace: R.doNothing | |
| }), R.serverInfo.get("prod") && _.extend(window.console, { | |
| log: a, | |
| info: a, | |
| warn: b, | |
| error: b, | |
| exception: b | |
| }) | |
| } | |
| }, R.logger.ensureConsole() | |
| }(), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment