import sixapi.*;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SixLogStd implements SixLog {
	private int logLevel=SixLog.DEBUG;
	private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	public SixLogStd(int logLevel) {
		this.logLevel = logLevel;
	}

	public void processSixLog(int criteria, String msg) {
		String out=null;
		switch(criteria){
			case DEBUG:
				out="DEBUG";
				break;
			case INFO:
				out="INFO";
				break;
			case WARNING:
				out="WARNING";
				break;
			case ERROR:
				out="ERROR";
				break;
			default:
				out="Unknown";
		}
		out+=" ";
		out+=((SimpleDateFormat)sdf.clone()).format(new Date());
		out+="-"+msg;
		System.out.println(out);
	}

	public boolean getSixLogFilter(int filter) {
		return filter <= logLevel;
	}

	public int getLogLevel() {
		return logLevel;
	}

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