YAHOO.namespace("com.lgan");
YAHOO.com.lgan.Logger = new (function(){
    var yuiLogger = YAHOO.widget.Logger;
    
    var FIREBUG_IN_USE = !!(
      !YAHOO.env.ua.ie
      && console
      && console.log
      && console.debug
      && console.info
      && console.warn
      && console.error
    )
    
    /**
      Returns true if using a console function; otherwise returns YAHOO.log.
    */
    this.log = function(p_msg, p_type, p_loc){
        var retval = true;
        if(!(FIREBUG_IN_USE && yuiLogger._browserConsoleEnabled)){
            retval = YAHOO.log(p_msg, p_type, p_loc);
        } else {
            switch(p_type){
                case "trace":
                    //The commented-out lines here make for an interesting tree view of the called functions, on the assumption that a logged function starts with a "Called." message and ends with a "Finished." message.  For an Analyzer, though, it's about 90 seconds of the Firebug console loading.
                    //if(console.group){
                    //    if(p_msg === "Called."){
                    //        console.group(p_loc);
                    //        console.info(p_loc + ":  ", p_msg);
                    //    } else if (p_msg === "Finished."){
                    //        console.info(p_loc + ":  ", p_msg);
                    //        console.groupEnd();
                    //    } else {
                    //        console.info(p_loc + ":  ", p_msg);
                    //    }
                    //} else {
                        console.info(p_loc + ":  ", p_msg);
                    //}
                break;
                case "debug":
                    console.debug(p_loc + ":  ", p_msg);
                break;
                case "error":
                    console.error(p_loc + ":  ", p_msg);
                break;
                case "warning":
                    console.warn(p_loc + ":  ", p_msg);
                break;
                default:
                    retval = YAHOO.log(p_msg, p_type, p_loc);
                break;
            }
        }
        return retval;
    };
})();

