Package net.sourceforge.javautil.common.logging.jdk

Source Code of net.sourceforge.javautil.common.logging.jdk.LoggerJDK

package net.sourceforge.javautil.common.logging.jdk;

import java.io.Writer;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

import net.sourceforge.javautil.common.ThrowableUtil;
import net.sourceforge.javautil.common.logging.LoggerAbstract;
import net.sourceforge.javautil.common.logging.ILoggerLevel;
import net.sourceforge.javautil.common.logging.LoggerLevelStandard;
import net.sourceforge.javautil.common.logging.LoggerWriter;
import net.sourceforge.javautil.common.logging.ILoggingFramework;

/**
* The logger wrapper for the JDK logging framework.
*
* @author elponderador
* @author $Author$
* @version $Id$
*/
public class LoggerJDK extends LoggerAbstract<LoggingFrameworkJDK> {
 
  protected final Logger logger;

  public LoggerJDK(LoggingFrameworkJDK jdkFramework, Logger logger) {
    super(jdkFramework);
    this.logger = logger;
   
  }

  public String getFullyQualifiedName() { return logger.getName(); }

  public String getName() { return logger.getName(); }

  public boolean isLogging() {
    return !logger.isLoggable(Level.OFF);
  }

  public boolean isDebug() {
    return logger.isLoggable(Level.FINE);
  }

  public boolean isError() {
    return logger.isLoggable(Level.SEVERE);
  }

  public boolean isFatal() {
    return logger.isLoggable(Level.SEVERE);
  }

  public boolean isInfo() {
    return logger.isLoggable(Level.INFO);
  }

  public boolean isWarn() {
    return logger.isLoggable(Level.WARNING);
  }

  public void log (ILoggerLevel level, String message) {
    this.log(new LogRecord(framework.getLevel(level), message));
  }
 
  public void log (ILoggerLevel level, String message, Throwable throwable) {
    this.log(new LogRecord(framework.getLevel(level), message + ThrowableUtil.toString(throwable)));
  }

  /**
   * @param log The log to log
   */
  private void log(LogRecord log) {
    this.framework.log(this, log);
  }

}
TOP

Related Classes of net.sourceforge.javautil.common.logging.jdk.LoggerJDK

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.