view rep/channel/REPLogger.java @ 487:455df381449a

separate blocking and merging
author one
date Thu, 21 Oct 2010 22:35:37 +0900
parents d2762d669617
children
line wrap: on
line source

package rep.channel;

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

	private int logLevel=3;
	/** simulation log command */
	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, 2);
	}

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

}