mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 04:22:56 +00:00
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:
parent
8ea2b9b321
commit
5cc84ad85a
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user