All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.service.log.slf4j.Slf4JLoggerWrapper Maven / Gradle / Ivy

package com.jpattern.service.log.slf4j;

import java.io.IOException;
import java.io.ObjectInputStream;

import com.jpattern.logger.ILogger;
import com.jpattern.logger.Slf4JLogger;

/**
 * 
 * @author Francesco Cina'
 *
 * 4 Mar 2011
 */
public class Slf4JLoggerWrapper implements ILogger {

	private static final long serialVersionUID = 1L;

	private transient ILogger logger;

	private final ILogger iLogger;

	private final Class aClass;
	
	public Slf4JLoggerWrapper(Class aClass, ILogger iLogger) {
		this.aClass = aClass;
		this.iLogger = iLogger;
		logger = new Slf4JLogger(aClass);
	}

	@Override
	public void trace(String method, String message) {
		iLogger.trace(method, message);
		logger.trace(method, message);
	}

	@Override
	public void debug(String method, String message) {
		iLogger.debug(method, message);
		logger.debug(method, message);
	}

	@Override
	public void info(String method, String message) {
		iLogger.info(method, message);
		logger.info(method, message);
	}

	@Override
	public void warn(String method, String message) {
		iLogger.warn(method, message);
		logger.warn(method, message);
	}

	@Override
	public void error(String method, String message) {
		iLogger.error(method, message);
		logger.error(method, message);
	}

	@Override
	public void error(String method, String message, Throwable exception) {
		iLogger.error(method, message, exception);
		logger.error(method, message, exception);
	}

	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		logger = new Slf4JLogger(aClass);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy