Adds Utils.ilog(...) for "interactive log".

The first time you use the function, it embeds Firebug Lite and then uses that console. This makes it easy to introspect objects, etc. All-around good stuff.
This commit is contained in:
aza@More-Better-Internet.local 2010-03-16 22:25:00 -07:00
parent 43f5103de0
commit 76f57ff6c3

View File

@ -81,6 +81,35 @@ var Utils = {
},
// ___ Logging
// Interactive logging!
ilog: function(){ // pass as many arguments as you want, it'll print them all
// If Firebug lite already exists, print to the console.
if( window.firebug ){
window.firebug.d.console.cmd.log.apply(null, arguments);
return;
}
// Else, embed it.
$('<link rel="stylesheet" href="../../js/firebuglite/firebug-lite.css"/>')
.appendTo("head");
$('<script src="../../js/firebuglite/firebug-lite.js"></script>')
.appendTo("body");
var args = arguments;
(function(){
var fb = window.firebug;
if(fb && fb.version){
fb.init();
fb.win.setHeight(100);
fb.d.console.cmd.log.apply(null, args);
}
else{setTimeout(arguments.callee);}
})();
},
log: function() { // pass as many arguments as you want, it'll print them all
var text = this.expandArgumentsForLog(arguments);
consoleService.logStringMessage(text);