package com.acme.logging; 


import weblogic.logging.NonCatalogLogger;
import com.acme.util.Parameters; 

/**
 * @author Selvan V. Rajan
 * @version 1.0 
 * 
 */
public class AppLogger
{ 
  NonCatalogLogger logger = null;
  
  static boolean allLoggingOn = Parameters.getProperty("AcmeLogger.loggingOn");
  static boolean serviceLoggingOn = Parameters.getProperty("AcmeService.logger.loggingOn");
  static boolean debugOn = Parameters.getProperty("AcmeService.logger.debugOn");
  static boolean errorOn = Parameters.getProperty("AcmeService.logger.errorOn");
  static boolean infoOn = Parameters.getProperty("AcmeService.logger.infoOn");
  static boolean warningOn = Parameters.getProperty("AcmeService.logger.warningOn");        


  public AppLogger(String appName) {
    logger = new NonCatalogLogger(appName);
  }
  
  public void debug(String msg) {
    if (allLoggingOn && serviceLoggingOn && debugOn)
        logger.debug(msg, null); 
  }
  public void debug(String msg, Throwable t) {
    if (allLoggingOn && serviceLoggingOn && debugOn)    
        logger.debug(msg, t); 
  }
  
  public void error(String msg) {
    if (allLoggingOn && serviceLoggingOn && errorOn)    
        logger.error(msg, null); 
  }
  public void error(String msg, Throwable t) {
    if (allLoggingOn && serviceLoggingOn && errorOn)
        logger.error(msg, t); 
  }
  
  public void info(String msg) {
    if (allLoggingOn && serviceLoggingOn && infoOn)    
    logger.info(msg, null); 
  }
  public void info(String msg, Throwable t) {
    if (allLoggingOn && serviceLoggingOn && infoOn)    
        logger.info(msg, t); 
  }
  
  public void warning(String msg) {
    if (allLoggingOn && serviceLoggingOn && warningOn)    
        logger.warning(msg, null); 
  }
  public void warning(String msg, Throwable t) {
    if (allLoggingOn && serviceLoggingOn && warningOn)    
        logger.warning(msg, t); 
  }
  
  //
//  Parameter class
//


} 
