[slf4j-dev] SLF4J Wrapper class line number incorrect
Ashley Westwell
ashley.westwell at netoffice.ca
Fri Feb 20 23:58:04 CET 2009
Good Afternoon
I have created a wrapper layer for SLF4J (Listed below). However the line number are incorrect, it is using the line numbers in the wrapper class not the class that I called the wrapper from. What is the correct way to fix this?
package com.test.commons.logging;
import com.test.commons.logging.LoggerFactory.LEVEL;
public class Logger {
private LEVEL infoLevel = LEVEL.FINE;
private LEVEL debugLevel = LEVEL.FINE;
private org.slf4j.Logger logger = null;
public Logger(Class clazz, LEVEL infoLevel, LEVEL debugLevel) {
this.infoLevel = infoLevel;
this.debugLevel = debugLevel;
logger = org.slf4j.LoggerFactory.getLogger(clazz);
}
public Logger(String name, LEVEL infoLevel, LEVEL debugLevel) {
this.infoLevel = infoLevel;
this.debugLevel = debugLevel;
logger = org.slf4j.LoggerFactory.getLogger(name);
}
public void info(String message) {
logger.info(message);
}
public void info(String message, Throwable throwable) {
logger.info(message, throwable);
}
public void info(String message, Object[] objects) {
if(logger.isInfoEnabled()) {
logger.info(message, objects);
}
}
public void info(LEVEL level, String message) {
if((logger.isInfoEnabled()) && (level.ordinal() <= infoLevel.ordinal())) {
logger.info(message);
}
}
public void info(LEVEL level, String message, Throwable throwable) {
if((logger.isInfoEnabled()) && (level.ordinal() <= infoLevel.ordinal())) {
logger.info(message, throwable);
}
}
public void info(LEVEL level, String message, Object[] objects) {
if((logger.isInfoEnabled()) && (level.ordinal() <= infoLevel.ordinal())) {
logger.info(message, objects);
}
}
// Debug messages.
public void debug(String message) {
if(logger.isDebugEnabled()) {
logger.debug(message);
}
}
public void debug(String message, Throwable throwable) {
if(logger.isDebugEnabled()) {
logger.debug(message, throwable);
}
}
public void debug(String message, Object[] objects) {
if(logger.isDebugEnabled()) {
logger.debug(message, objects);
}
}
public void debug(LEVEL level, String message) {
if((logger.isDebugEnabled()) && (level.ordinal() <= debugLevel.ordinal())) {
logger.debug(message);
}
}
public void debug(LEVEL level, String message, Throwable throwable) {
if((logger.isDebugEnabled()) && (level.ordinal() <= debugLevel.ordinal())) {
logger.debug(message, throwable);
}
}
public void debug(LEVEL level, String message, Object[] objects) {
if((logger.isDebugEnabled()) && (level.ordinal() <= debugLevel.ordinal())) {
logger.debug(message, objects);
}
}
// The highest value; intended for extremely important messages (e.g. fatal program errors).
public void severe(String message) {
if(logger.isErrorEnabled()) {
logger.error(message);
}
}
public void severe(String message, Throwable throwable) {
if(logger.isErrorEnabled()) {
logger.error(message, throwable);
}
}
public void severe(String message, Object[] objects) {
if(logger.isErrorEnabled()) {
logger.error(message, objects);
}
}
// Intended for warning messages.
public void warning(String message) {
if(logger.isWarnEnabled()) {
logger.warn(message);
}
}
public void warning(String message, Throwable throwable) {
if(logger.isWarnEnabled()) {
logger.warn(message, throwable);
}
}
public void warning(String message, Object[] objects) {
if(logger.isWarnEnabled()) {
logger.warn(message, objects);
}
}
}
Notice: This email is confidential. If you are not the intended recipient, please notify the sender by return email and delete this message from your mail box without reading or copying it or any attachments.
Attention: Ce courriel est confidentiel. Si vous n'êtes pas le destinataire prévu, veuillez en informer l'expéditeur par le courriel de retour et le supprimer immédiatement sans le lire ou le copier (incluant les pièces jointes, le cas échéant).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20090220/e590bcb9/attachment.htm>
More information about the slf4j-dev
mailing list