/*
    Look-Look Javascript Logger
    This is logging code to allow for easier debugging of Javascript code.

    Below are application code hooks into the LL_Logger code.  These methods are
    easy to remember (and familiar to those who've used Log4J, etc) ways to get your code logging.

    When using this code in your pages, there needs to be a hooks file referenced as well as a
    core file (which actually contains the code of the logging system.
*/

var LL_LOGGING_DEFAULT_LOGGER = new LL_Logger();

var LL_LOGGING_DEFAULT_LEVELS = LL_LOGGING_DEFAULT_LOGGER.levels;

/*
    These methods can be called with a number of different arguments.  The number of actual
    arguments decides how the LL_LogEvent is constructed.

    1 - message

    1 - component
    2 - message


*/

function trace() {
    ll_logger_log('TRACE', arguments);
}

function debug() {
    ll_logger_log('DEBUG', arguments);
}

function warn() {
    ll_logger_log('WARN', arguments);
}

function info() {
    ll_logger_log('INFO', arguments);
}

function error() {
    ll_logger_log('ERROR', arguments);
}

function fatal() {
    ll_logger_log('FATAL', arguments);
}

/*
    arguments
*/
function ll_logger_log(level, args) {
    var logEvent = new LL_LogEvent();
    logEvent.level = level;

    logEvent.component = (args[1]) ? args[0] : 'default';
    logEvent.message = (args[1]) ? args[1] : args[0] ;

    LL_LOGGING_DEFAULT_LOGGER.log(logEvent);
}