JSDoc Documentation
Summary
Javascript Logger (in the spirit of log4j)
This library is designed to make the writing and debugging
of javascript code easier, by allowing the programmer to perform
debug or log output at any place in their code. This supports
the concept of different levels of logging (debug < info < warn < error < fatal << none)
as well as different log outputs. Three log outputs are included, but you can
add your own. The included log outputs are Log.writeLogger(),
Log.alertLogger(), and Log.popupLogger(). For debugging on Safari,
the log ouput Log.consoleLogger() is also included. To turn off debugging
but still leave the logger calls in your script, use the log level Log.NONE.
Example usage:
<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>
Version: 0.31
*************************************************************
Copyright 2005 Fourspaces Consulting, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License
*************************************************************
Changelog:
0.31 Bug fix (resizeable should be resizable - Darryl Lyons)
0.3 Migrated to SF.net SVN repository - test cleanups
0.2 - Added consoleLogger for Safari
- Changed popupLogger so that it only notifies once (or twice)
that a popup blocker is active.
- Added Log.NONE level for silencing all logging
Author: Marcus R Breese mailto:mbreese@users.sourceforge.net
File Summary
|
log4js.js |
Javascript Logger (in the spirit of log4j)
This library is designed to make the writing and debugging
of javascript code easier, by allowing the programmer to perform
debug or log output at any place in their code. |
Documentation generated by
JSDoc on Sun Jun 25 22:58:36 2006