View the Project on GitHub


A simple debugger for web sites using the browser's console. Based on the console wrapper from Paul Irish.

A demo page is provided so you can see the code in action.

Usage & Features

The default state for the debugger is off. There are two ways to turn the debugger on.

  1. Set the debug.on property to *true*, debug.on = true;. The default is *false*.
  2. Add a query string to the URL of debug=true,

Basic Usage

You use this debugger just as you would the normal browser console.log() except you replace “console” with “debug”.

debug.log('This is a log message');

String Substitution

Just like with the normal console you can use string substitution

var animal = 'cow',
    count = 10;
debug.log("The %s jumped over %d tall buildings", animal, count);

The above code will output to the console as “The cat jumped over 10 buildings”

Debug History

All calls to the debug object will be saved in debug.history which is an array of all the messages sent to the debug object.

var animal = 'dog',
    count = 1;
debug.on = true;
debug.log('The %s jumped over %d tall buildings', animal, count);
debug.debug('example.html - line 10: There was a problem');
debug.warn('watch your step!');
debug.error('OMG, things are blowing up!');
    debug.history[0] outputs ['The %s jumped over %d tall buildings', animal, count]
    debug.history[3] outputs ['OMG, things are blowing up!']    

Supported Console Types

Here is a list of the current supported console message types:

log, info, warn, error, debug, dir, group, groupEnd

Copyright & License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.