JSLog — Unobtrusive JavaScript Logger

Linked off the FAQ for Firebug (another nice Firefox extension for debugging), I ran across JSLog. In short, it's a JavaScript library for unobtrusively adding logging to a page. The extension’s web page puts it this way:

Every language needs a System.out.println() or a Console.writeLine() — a quick and easy way to output messages to you, the developer, during development and testing. Historically, Javascript programmers have used alert() for this purpose. […] Safe to say that if you've done AJAX programming, you are sick of alert(). JSLog solves these problems! […]

Considering that I’m working on a webapp with heavy DOM Scripting, I think this’ll be just what I need:

  • It’s absolutely positioned, so it doesn’t affect the layout of the page
  • It can be enabled or disabled by setting a single variable, so debug statements can remain in scripts and appear only when needed
  • It supports several alert-levels (debug, warning, info, and error) to differentiate messages of varying severity

What’s also nice is that it’s pretty small — in minimized form, it’s just a box with a number in it (counting the number of messages in the console). I suppose it could be conceivably left enabled on a development server without getting in the way of other developers. I can’t wait to put this to use.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.