/*
 * Created on 2005.07.25.
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.etixpert.evolution.gui.servlets;

import org.apache.log4j.Logger;
import javax.servlet.http.*;

/**
 * @author aintitfun
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class SLogger extends Logger {
	public static HttpSession session = null;
	/**
	 * @param arg0
	 */
	public SLogger(String arg0) {
		super(arg0);
		// TODO Auto-generated constructor stub
	}
	
	public void info(Object message) {
		StringBuffer plus = new StringBuffer();
		try {
			if (session.getAttribute("USER_LOGGED_REMOTE_ADDRESS")!=null) plus.append((String)session.getAttribute("USER_LOGGED_REMOTE_ADDRESS")+", ");
			if (session.getAttribute("USER_LOGGED_ID")!=null) plus.append((String)session.getAttribute("USER_LOGGED_ID")+", ");
			if (session.getAttribute("USER_LOGGED_LEVEL_ID")!=null) plus.append((String)session.getAttribute("USER_LOGGED_LEVEL_ID")+": ");
		} catch (Exception e) {}
		
		super.info(plus+" "+message);
	}
	
	public void warn(Object message) {
		StringBuffer plus = new StringBuffer();
		try {
			if (session.getAttribute("USER_LOGGED_REMOTE_ADDRESS")!=null) plus.append((String)session.getAttribute("USER_LOGGED_REMOTE_ADDRESS")+", ");
			if (session.getAttribute("USER_LOGGED_ID")!=null) plus.append((String)session.getAttribute("USER_LOGGED_ID")+", ");
			if (session.getAttribute("USER_LOGGED_LEVEL_ID")!=null) plus.append((String)session.getAttribute("USER_LOGGED_LEVEL_ID")+": ");
		} catch (Exception e) {}
		
		super.warn(plus+" "+message);
	}
	
	public void error(Object message) {
		StringBuffer plus = new StringBuffer();
		try {
			if (session.getAttribute("USER_LOGGED_REMOTE_ADDRESS")!=null) plus.append((String)session.getAttribute("USER_LOGGED_REMOTE_ADDRESS")+", ");
			if (session.getAttribute("USER_LOGGED_ID")!=null) plus.append((String)session.getAttribute("USER_LOGGED_ID")+", ");
			if (session.getAttribute("USER_LOGGED_LEVEL_ID")!=null) plus.append((String)session.getAttribute("USER_LOGGED_LEVEL_ID")+": ");
		} catch (Exception e) {}
		
		super.error(plus+" "+message);
	}
}
