Diffstat (limited to 'frontend/gamma/js/MochiKit/Logging.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/MochiKit/Logging.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/frontend/gamma/js/MochiKit/Logging.js b/frontend/gamma/js/MochiKit/Logging.js index f00996b..8b06e0b 100644 --- a/frontend/gamma/js/MochiKit/Logging.js +++ b/frontend/gamma/js/MochiKit/Logging.js @@ -1,59 +1,59 @@ /*** MochiKit.Logging 1.5 See <http://mochikit.com/> for documentation, downloads, license, etc. (c) 2005 Bob Ippolito. All rights Reserved. ***/ -MochiKit.Base._module('Logging', '1.5', ['Base']); +MochiKit.Base.module(MochiKit, 'Logging', '1.5', ['Base']); /** @id MochiKit.Logging.LogMessage */ MochiKit.Logging.LogMessage = function (num, level, info) { this.num = num; this.level = level; this.info = info; this.timestamp = new Date(); }; MochiKit.Logging.LogMessage.prototype = { /** @id MochiKit.Logging.LogMessage.prototype.repr */ repr: function () { var m = MochiKit.Base; return 'LogMessage(' + m.map( m.repr, [this.num, this.level, this.info] ).join(', ') + ')'; }, /** @id MochiKit.Logging.LogMessage.prototype.toString */ toString: MochiKit.Base.forwardCall("repr") }; MochiKit.Base.update(MochiKit.Logging, { /** @id MochiKit.Logging.logLevelAtLeast */ logLevelAtLeast: function (minLevel) { var self = MochiKit.Logging; if (typeof(minLevel) == 'string') { minLevel = self.LogLevel[minLevel]; } return function (msg) { var msgLevel = msg.level; if (typeof(msgLevel) == 'string') { msgLevel = self.LogLevel[msgLevel]; } return msgLevel >= minLevel; }; }, /** @id MochiKit.Logging.isLogMessage */ isLogMessage: function (/* ... */) { var LogMessage = MochiKit.Logging.LogMessage; for (var i = 0; i < arguments.length; i++) { if (!(arguments[i] instanceof LogMessage)) { return false; } } return true; @@ -142,97 +142,97 @@ MochiKit.Logging.Logger.prototype = { /** @id MochiKit.Logging.Logger.prototype.baseLog */ baseLog: function (level, message/*, ...*/) { if (typeof(level) == "number") { if (level >= MochiKit.Logging.LogLevel.FATAL) { level = 'FATAL'; } else if (level >= MochiKit.Logging.LogLevel.ERROR) { level = 'ERROR'; } else if (level >= MochiKit.Logging.LogLevel.WARNING) { level = 'WARNING'; } else if (level >= MochiKit.Logging.LogLevel.INFO) { level = 'INFO'; } else { level = 'DEBUG'; } } var msg = new MochiKit.Logging.LogMessage( this.counter, level, MochiKit.Base.extend(null, arguments, 1) ); this._messages.push(msg); this.dispatchListeners(msg); if (this.useNativeConsole) { this.logToConsole(msg.level + ": " + msg.info.join(" ")); } this.counter += 1; while (this.maxSize >= 0 && this._messages.length > this.maxSize) { this._messages.shift(); } }, /** @id MochiKit.Logging.Logger.prototype.getMessages */ getMessages: function (howMany) { var firstMsg = 0; if (!(typeof(howMany) == 'undefined' || howMany === null)) { firstMsg = Math.max(0, this._messages.length - howMany); } return this._messages.slice(firstMsg); }, /** @id MochiKit.Logging.Logger.prototype.getMessageText */ getMessageText: function (howMany) { if (typeof(howMany) == 'undefined' || howMany === null) { howMany = 30; } var messages = this.getMessages(howMany); if (messages.length) { - var lst = map(function (m) { + var lst = MochiKit.Base.map(function (m) { return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' '); }, messages); lst.unshift('LAST ' + messages.length + ' MESSAGES:'); return lst.join(''); } return ''; }, /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */ debuggingBookmarklet: function (inline) { if (typeof(MochiKit.LoggingPane) == "undefined") { alert(this.getMessageText()); } else { MochiKit.LoggingPane.createLoggingPane(inline || false); } } }; MochiKit.Logging.__new__ = function () { this.LogLevel = { ERROR: 40, FATAL: 50, WARNING: 30, INFO: 20, DEBUG: 10 }; var m = MochiKit.Base; m.registerComparator("LogMessage", this.isLogMessage, this.compareLogMessage ); var partial = m.partial; var Logger = this.Logger; var baseLog = Logger.prototype.baseLog; m.update(this.Logger.prototype, { debug: partial(baseLog, 'DEBUG'), log: partial(baseLog, 'INFO'), error: partial(baseLog, 'ERROR'), fatal: partial(baseLog, 'FATAL'), warning: partial(baseLog, 'WARNING') }); // indirectly find logger so it can be replaced var self = this; var connectLog = function (name) { |