Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Custom logger implementation on top of jquery

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 LICENSE
Octocat-spinner-32 jquery.logger.airbrake.js
Octocat-spinner-32 jquery.logger.ajax.js
Octocat-spinner-32 jquery.logger.js
Octocat-spinner-32 jquery.logger.window.js


Provides the ability to log messages for debugging. Features includes:

  • IE support via Firebug
  • Report exceptions to a web server
  • Pluggable web server backends (with Airbrake support)
  • Detailed reports for AJAX errors
  • Logger level, environment, user agent, and message matching filters
  • Global context to include with every exception report


  • jquery.logger - Core logger API


  • jquery.logger.window - Track errors raised in setTimeout / setInterval calls
  • jquery.logger.ajax - Tracks errors in $.ajax calls
  • - Tracks errors in DOM events
  • jquery.logger.airbrake - Provides an integration for Airbrake



$.logger.level = $.logger.LEVELS.development;
$.logger.environment = 'development';
$.logger.firebugLite.enabled = false;
$.logger.context = {
  user_id: function() { return; },
  startTime: (new Date()).toString()
$.logger.onerror = function(message) {
  // Do something with the message object
$.logger.filters.userAgents = ['msie 6'];
$.logger.filters.messages = [
  'Permission denied to call method Location.toString',
  'Automation server can\'t create object',
  'Unspecified error',
  'Out of memory'

Logging errors:

$.logger.debug('This is a debug message');

$'This is an info message');

$.logger.warn('This is a warn message');

var error = new Error('This is an error message');
error.customData = {appId: 123};

Automatically reporting errors:

var fn = $.logger.fn(function() {
  throw new Error('Something bad happened!');

var fnWithData = $.logger.fn(function() {
  throw new Error('Something bad happened!');
}, {method: 'fnWithData'});

Airbrake integration

To use Airbrake as your web server backend:

  • Add Airbrake's official javascript plugin and jquery.logger.airbrake.js to your page.
  • Add the following javascript to configure Airbrake:
$.extend(Airbrake, {
  // Fix parameters with null values causing issues in the Airbrake lib
  generateXMLWithoutKeys: Airbrake.generateXML,
  generateXML: function(error) {
    for (var param in error.params) {
      error.params[param] += '';

    return this.generateXMLWithoutKeys(error);
$.logger.developmentEnvironments = ['development', 'test'];
Something went wrong with that request. Please try again.