views:

73

answers:

2

I use firebug a lot. However I do not like typing console.log all the time. I would rather type just log. So at the top of my console window I add this line all the time.

function log(){try{console.log.apply(console,arguments);}catch(e){}}
log(2 + 2);

I don't like to type that log statement every single time.

Is there a way I can tell either firefox or firebug to include that log function all the time.I guess I want to tinker with firebug and ask it to add that one function anytime it comes up live.

Any thoughts.

A: 

OK, this is probably a more complicated answer than you were after, but this is what I would do. I would build for myself a tiny Firefox extension which used an overlay to add a script into the windows which you are interested in, in this case the console window. The script would define anything you wanted in the context of this window, including your log() function. When Firefox opens the console window, it will run your script in this context, making the function available to you.

However, if you're not comfortable or experienced with creating Firefox extensions, this is unlikely to help in your particular case.

Tim
A: 

Have you tried to create a Greasemonkey script?

Wabbitseason