view rep/channel/REPLogger.java @ 213:4d9b32666ed2

*** empty log message ***
author pin
date Sat, 30 Aug 2008 17:56:06 +0900
parents 72252e970a8b
children edb373aa421e
line wrap: on
line source

package rep.channel;

public class REPLogger {
	static REPLogger single;
	
	public static REPLogger singleton(){
		if(single==null){
			synchronized(REPLogger.class){
				if(single==null)
					single = new REPLogger();
			}
		}
		return single;
	}
	protected REPLogger(){
	}

	private int logLevel;
	/** simulation log command */
	synchronized public void writeLog(String log, int level){
		if ( level<=logLevel )
			System.out.println(Thread.currentThread().getName()+": "+log);
		System.out.flush();
	}
	public void writeLog(String log){
		writeLog(log, 0);
	}

	synchronized public void setLogLevel(int logLevel) {
		this.logLevel = logLevel;
	}

}