org.beigesoft.alog.LoggerStandard Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of a-jetty-base Show documentation
Show all versions of a-jetty-base Show documentation
A-Jetty Base can run on Android Java as well as on standard Java 7+ and it can run precompiled JSP/JSTL.
package org.beigesoft.alog;
/*
* Beigesoft ™
*
* Licensed under the Apache License, Version 2.0
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
import java.util.logging.Logger;
import java.util.logging.Level;
/**
* Implementation of Logger adapter with java.util.logging.
* This logger used in already preconfigured container e.g. Tomcat.
*
* @author Yury Demidenko
*/
public class LoggerStandard implements ILogger {
/**
* logger.
**/
private Logger logger = Logger.getAnonymousLogger();
/**
* Is show debug messages.
**/
private boolean isShowDebugMessage;
/**
* Make debug log.
* @param pClazz of debudgged bean
* @param pMsg message
**/
@Override
public final void debug(final Class> pClazz,
final String pMsg) {
if (this.isShowDebugMessage) {
logger.log(Level.INFO, pClazz.getSimpleName() + ": " + pMsg);
}
}
/**
* Make info log.
* @param pClazz of bean
* @param pMsg message
**/
@Override
public final void info(final Class> pClazz,
final String pMsg) {
logger.log(Level.INFO, pClazz.getSimpleName() + ": " + pMsg);
}
/**
* Make error log.
* @param pClazz of bean
* @param pMsg message
**/
@Override
public final void error(final Class> pClazz,
final String pMsg) {
logger.log(Level.SEVERE, pClazz.getSimpleName() + ": " + pMsg);
}
/**
* Make warn log.
* @param pClazz of bean
* @param pMsg message
**/
@Override
public final void warn(final Class> pClazz,
final String pMsg) {
logger.log(Level.WARNING, pClazz.getSimpleName() + ": " + pMsg);
}
/**
* Set is show debug messages.
* @param pIsShowDebugMessage is show debug messages?
**/
@Override
public final void setIsShowDebugMessages(
final boolean pIsShowDebugMessage) {
this.isShowDebugMessage = pIsShowDebugMessage;
}
/**
* Get is show debug messages.
* @return is show debug messages?
**/
@Override
public final boolean getIsShowDebugMessages() {
return this.isShowDebugMessage;
}
//Simple getters and setters:
/**
* Geter for logger.
* @return Logger
**/
public final Logger getLogger() {
return this.logger;
}
/**
* Setter for logger.
* @param pLogger reference
**/
public final void setLogger(final Logger pLogger) {
this.logger = pLogger;
}
}