Designs | Resume | | email: ayubx003 (

« Mini Review: Anathem [Neal Stephenson] | Main | How To: Programmatically Add Nodes to the SiteMap For Your .NET Site [Tips & Tricks] »

Creating a Wrapper for Firebug's Console [Tips & Tricks] | Posted at 12:20 PM

Thanks to Dimitar over at Frag on how to create a wrapper for Firebug's console, I was able to implement better debugging in my jQuery plugin. The one quip I had was that I needed to directly pass everything to the log function. The way Dimitar did it, it wrote a log line for each argument. I was passing formatted strings.

Here are the offending lines:

for (var i = 0, l = arguments.length; i < l; i++)

And here's what you replace it with:

console.log.apply(this, arguments);

BAM! Works like a charm.

Thanks Dimitar!

Filed Under: Coding Tips and Tricks


hey - thanks for the tip. I should have read the firebug source / manual to see if there was a more appropriate method than looping through vars :)

updated and credited.

tried hours and hours to get this... thank you so much! really works like charm ;)

erm - you may want to update it as the apply breaks on Safari 4's console.log (probably not a normal function).

added a try block instead - check the original post :)

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About the Author

Divide by Zero is Kamran Ayub's personal blog. Kamran owns and operates Intrepid Studios, a web design and development firm based in Minneapolis. Despite the above picture, Kamran is usually an intelligent person. Please forgive him.

View Kamran Ayub's profile on LinkedIn

Add to Technorati Favorites