[KSS-checkins] r36185 - kukit/kukit.js/branch/ree-events-cleanup/kukit
reebalazs at codespeak.net
reebalazs at codespeak.net
Sun Jan 7 08:55:12 CET 2007
Author: reebalazs
Date: Sun Jan 7 08:55:11 2007
New Revision: 36185
Modified:
kukit/kukit.js/branch/ree-events-cleanup/kukit/utils.js
Log:
Merge from trunk -r36152:36184
Modified: kukit/kukit.js/branch/ree-events-cleanup/kukit/utils.js
==============================================================================
--- kukit/kukit.js/branch/ree-events-cleanup/kukit/utils.js (original)
+++ kukit/kukit.js/branch/ree-events-cleanup/kukit/utils.js Sun Jan 7 08:55:11 2007
@@ -3,7 +3,7 @@
* Authors:
* Godefroid Chapelle <gotcha at bubblenet.be>
* Florian Schulze <florian.schulze at gmx.net>
-* Balázs Reé <ree at greenfinity.hu>
+* Balazs Ree <ree at greenfinity.hu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -26,51 +26,75 @@
var kukit = {};
}
-// Browser identification. We need this one only atm.
+// Browser identification. We need these switches only at the moment.
try {
kukit.HAVE_SAFARI = navigator.vendor && navigator.vendor.indexOf('Apple') != -1;
kukit.HAVE_IE = eval("_SARISSA_IS_IE");
} catch (e) {}
+// Activation of extra logging panel: if necessary
+// this allows to start the logging panel from the browser with
+// javascript:kukit.showlog();
+kukit.showlog = function() {
+ kukit.logWarning('Logging is on the console: request to show logging pane ignored');
+};
+
/* check whether the logging stuff of Firebug is available */
-try {
- console.log('Initializing kukit');
- /* following call is needed to generate exception in Safari */
- // XXX this fails now on FF 2 too. Can some Safari user please
- // check the current logging solution and adjust accordingly?
- //console.assertEquals('kukit', 'kukit');
- if (kukit.HAVE_SAFARI) {
- throw "Let's get out.";
- }
- kukit.hasFirebug = true;
-} catch(e) {
- kukit.hasFirebug = false;
- }
-
-if (kukit.hasFirebug) {
- kukit.log = console.log;
- kukit.logDebug = console.debug;
- kukit.logFatal = console.error;
- kukit.logError = console.error;
- kukit.logWarning = console.warn;
+if (typeof kukit.log == 'undefined' &&
+ typeof console != 'undefined' &&
+ typeof console.log != 'undefined' &&
+ typeof console.debug != 'undefined' &&
+ typeof console.error != 'undefined' &&
+ typeof console.warn != 'undefined') {
+ kukit.log = console.log;
+ kukit.logDebug = console.debug;
+ kukit.logFatal = console.error;
+ kukit.logError = console.error;
+ kukit.logWarning = console.warn;
}
-else {
+
/* check whether the logging stuff of MochiKit is available */
- try {
- MochiKit.Logging.log('Initializing kukit');
+if (typeof kukit.log == 'undefined' &&
+ typeof MochiKit != 'undefined' &&
+ typeof MochiKit.Logging != 'undefined' &&
+ typeof MochiKit.Logging.log != 'undefined') {
kukit.log = MochiKit.Logging.log;
kukit.logError = MochiKit.Logging.logError;
kukit.logDebug = MochiKit.Logging.logDebug;
kukit.logFatal = MochiKit.Logging.logFatal;
kukit.logWarning = MochiKit.Logging.logWarning;
- } catch(e) {
+ // make convenience url
+ // javascript:kukit.showlog();
+ // instead of the need to say
+ // javascript:void(createLoggingPane(true));
+ kukit.showlog = function() {
+ createLoggingPane(true);
+ };
+}
+
+/* check whether the logging stuff of Safari is available */
+if (typeof kukit.log == 'undefined' &&
+ typeof console != 'undefined' &&
+ typeof console.log != 'undefined') {
+ kukit.log = function(str) { console.log('INFO: '+str); };
+ kukit.logError = function(str) { console.log('ERROR: '+str); };
+ kukit.logDebug = function(str) { console.log('DEBUG: '+str); };
+ kukit.logFatal = function(str) { console.log('FATAL: '+str); };
+ kukit.logWarning = function(str) { console.log('WARNING: '+str); };
+}
+
+/* no logging solution available */
+if (typeof kukit.log == 'undefined') {
kukit.log = function(str){};
kukit.logError = kukit.log;
kukit.logDebug = kukit.log;
kukit.logFatal = kukit.log;
kukit.logWarning = kukit.log;
- }
}
+
+// log a startup message
+kukit.log('Initializing kss');
+
/* utilities */
kukit.ut = {};
More information about the Kukit-checkins
mailing list