summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/MochiKit/Logging.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/MochiKit/Logging.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/MochiKit/Logging.js4
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,35 +1,35 @@
1/*** 1/***
2 2
3MochiKit.Logging 1.5 3MochiKit.Logging 1.5
4 4
5See <http://mochikit.com/> for documentation, downloads, license, etc. 5See <http://mochikit.com/> for documentation, downloads, license, etc.
6 6
7(c) 2005 Bob Ippolito. All rights Reserved. 7(c) 2005 Bob Ippolito. All rights Reserved.
8 8
9***/ 9***/
10 10
11MochiKit.Base._module('Logging', '1.5', ['Base']); 11MochiKit.Base.module(MochiKit, 'Logging', '1.5', ['Base']);
12 12
13 /** @id MochiKit.Logging.LogMessage */ 13 /** @id MochiKit.Logging.LogMessage */
14MochiKit.Logging.LogMessage = function (num, level, info) { 14MochiKit.Logging.LogMessage = function (num, level, info) {
15 this.num = num; 15 this.num = num;
16 this.level = level; 16 this.level = level;
17 this.info = info; 17 this.info = info;
18 this.timestamp = new Date(); 18 this.timestamp = new Date();
19}; 19};
20 20
21MochiKit.Logging.LogMessage.prototype = { 21MochiKit.Logging.LogMessage.prototype = {
22 /** @id MochiKit.Logging.LogMessage.prototype.repr */ 22 /** @id MochiKit.Logging.LogMessage.prototype.repr */
23 repr: function () { 23 repr: function () {
24 var m = MochiKit.Base; 24 var m = MochiKit.Base;
25 return 'LogMessage(' + 25 return 'LogMessage(' +
26 m.map( 26 m.map(
27 m.repr, 27 m.repr,
28 [this.num, this.level, this.info] 28 [this.num, this.level, this.info]
29 ).join(', ') + ')'; 29 ).join(', ') + ')';
30 }, 30 },
31 /** @id MochiKit.Logging.LogMessage.prototype.toString */ 31 /** @id MochiKit.Logging.LogMessage.prototype.toString */
32 toString: MochiKit.Base.forwardCall("repr") 32 toString: MochiKit.Base.forwardCall("repr")
33}; 33};
34 34
35MochiKit.Base.update(MochiKit.Logging, { 35MochiKit.Base.update(MochiKit.Logging, {
@@ -166,49 +166,49 @@ MochiKit.Logging.Logger.prototype = {
166 this.logToConsole(msg.level + ": " + msg.info.join(" ")); 166 this.logToConsole(msg.level + ": " + msg.info.join(" "));
167 } 167 }
168 this.counter += 1; 168 this.counter += 1;
169 while (this.maxSize >= 0 && this._messages.length > this.maxSize) { 169 while (this.maxSize >= 0 && this._messages.length > this.maxSize) {
170 this._messages.shift(); 170 this._messages.shift();
171 } 171 }
172 }, 172 },
173 173
174 /** @id MochiKit.Logging.Logger.prototype.getMessages */ 174 /** @id MochiKit.Logging.Logger.prototype.getMessages */
175 getMessages: function (howMany) { 175 getMessages: function (howMany) {
176 var firstMsg = 0; 176 var firstMsg = 0;
177 if (!(typeof(howMany) == 'undefined' || howMany === null)) { 177 if (!(typeof(howMany) == 'undefined' || howMany === null)) {
178 firstMsg = Math.max(0, this._messages.length - howMany); 178 firstMsg = Math.max(0, this._messages.length - howMany);
179 } 179 }
180 return this._messages.slice(firstMsg); 180 return this._messages.slice(firstMsg);
181 }, 181 },
182 182
183 /** @id MochiKit.Logging.Logger.prototype.getMessageText */ 183 /** @id MochiKit.Logging.Logger.prototype.getMessageText */
184 getMessageText: function (howMany) { 184 getMessageText: function (howMany) {
185 if (typeof(howMany) == 'undefined' || howMany === null) { 185 if (typeof(howMany) == 'undefined' || howMany === null) {
186 howMany = 30; 186 howMany = 30;
187 } 187 }
188 var messages = this.getMessages(howMany); 188 var messages = this.getMessages(howMany);
189 if (messages.length) { 189 if (messages.length) {
190 var lst = map(function (m) { 190 var lst = MochiKit.Base.map(function (m) {
191 return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' '); 191 return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' ');
192 }, messages); 192 }, messages);
193 lst.unshift('LAST ' + messages.length + ' MESSAGES:'); 193 lst.unshift('LAST ' + messages.length + ' MESSAGES:');
194 return lst.join(''); 194 return lst.join('');
195 } 195 }
196 return ''; 196 return '';
197 }, 197 },
198 198
199 /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */ 199 /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */
200 debuggingBookmarklet: function (inline) { 200 debuggingBookmarklet: function (inline) {
201 if (typeof(MochiKit.LoggingPane) == "undefined") { 201 if (typeof(MochiKit.LoggingPane) == "undefined") {
202 alert(this.getMessageText()); 202 alert(this.getMessageText());
203 } else { 203 } else {
204 MochiKit.LoggingPane.createLoggingPane(inline || false); 204 MochiKit.LoggingPane.createLoggingPane(inline || false);
205 } 205 }
206 } 206 }
207}; 207};
208 208
209MochiKit.Logging.__new__ = function () { 209MochiKit.Logging.__new__ = function () {
210 this.LogLevel = { 210 this.LogLevel = {
211 ERROR: 40, 211 ERROR: 40,
212 FATAL: 50, 212 FATAL: 50,
213 WARNING: 30, 213 WARNING: 30,
214 INFO: 20, 214 INFO: 20,