New Firebug (0.4)
Holy crap. I’m watching this video of Joe Hewitt (author of Dom Inspector and Firebug) and I’m blown away by the latest version. I’m a little miffed that the printfire() function (which let you put error messages into the firebug console) is now deprecated, which means that all my libraries need to be updated, but I think I’ll get over it fast enough.
New in this version is the console.log() function that rocks. You can just do this:
console.log(”hi there”);
which will log the text into the console. No big deal. You can also parse a string into the log entry like so:
console.log(”%s has a problem”, ObjectName);
which will print out ”
has a problem”You can stack these up:
console.log(”Item %s is named %s”, ObjectId, ObjectName);
The console logger has several ways to log things including console.warn, console.info, console.debug and console.error, which are highlighted differently and include a link to the line number in the debugger (another new feature; I’ll get to that in a second).
The console also has assertions where you can simplify code like this:
if (some evaluation)
console.log(’error!’);
into
console.assert(some evaluation, ‘error!’);
There are numerous kinds of assertions including Equals, NotEquals, GreaterThan, Contains, NotNull, etc.
There are functions like console.trace() which gives you a stack trace of the code at that point. console.time(”name”) and console.timeEnd(”name”) will tell you how long it took to get from the time() open to the timeEnd() close (great for optimizing runtime code), and console.count(”name”) will tell you how many times a line has been executed.
Finally, there’s a new debugger. You can pause your code at any point and follow it’s execution. Additionally, you can insert into your code:
debugger;
and your code will pause and pop open the debugger view. This view will show you your code at it’s current paused spot, and also show you everything on the stack; variables, objects, etc. You can also set an option to have it always break on errors.
To see this in action, just watch this 20 minute video.
More details:
http://www.joehewitt.com/software/firebug/
release notes:
http://www.joehewitt.com/software/firebug/releases/0.4notes.php
