Home / Wiki / Javascript Logging
All Pages

Javascript Logging

From Monket

Jump to: navigation, search

A simple javascript logging framework.

Javascript Logging provides an unobtrusive way of debugging your javascript. A small expandable div positioned in the top left corner of your page displays the logs. Any errors logged using logError(e) automatically expand the log, providing instant feedback when something goes wrong. Logging can be turned off for production systems without having to remove all the logging code.

Contents

Screenshot

Image:JavascriptLogging.png

Download Latest Version

Javascript Logging v1.2

All Versions

Usage

In Your HTML

  <script language="JavaScript" type="text/javascript" src="js/logging.js"></script>

In Your Javascript

  try {
    // ...
    log('value of foo: ' + foo);
    //...
  } catch(e) {
    logError(e);
  }

Options

  loggingDisplay = false;                   // The log will no longer be created or displayed

  loggingStartExpanded = true;              // The log will start expanded

  LOGGING_BASE = '/javascript-logging/';    // The location where javascript logging was unzipped to
                                            // so that the CSS + additional javascript can be loaded