Log4JS is a logging class in similar spirit to Apache Logging, specifically Log4J. Log4JS is a javascript class that can be used to log messages to a customizable logger class. The primary use for this is in debugging javascript code.
Four logger classes are included: alert, write, popup, and console. For more information, please see the docs.
Example usage: test.html
<html>
<head>
<script src="log4js.js" type="text/javascript"></script>
</head>
<body>
Log4JS test...<hr/>
<script>
// Setup log objects
//
// log object of priority debug and the popup logger
var log = new Log(Log.DEBUG, Log.popupLogger);
// log object of priority warn and the alert logger
var log2 = new Log(Log.WARN, Log.alertLogger);
// log object of priority debug and the console logger (Safari)
var log3 = new Log(Log.DEBUG, Log.consoleLogger);
log.debug('foo1'); // will popup a new window and log 'foo'
log.warn('bar1'); // will add a new 'bar' message to the popup
log2.debug('foo2'); // will do nothing (Log object's priority threshold is WARN)
log2.warn('bar2'); // will display a javascript alert with the string 'bar'
log3.debug('foo3'); // will log message to Safari console or existing popup
log3.warn('bar3'); // same
log.info(Log.dumpObject(new Array('apple','pear','orange','banana')));
</script>
</body>
</html>