package demo.domain;

import java.io.Serializable;

public class LogMessage implements Serializable {
	private static final long serialVersionUID = 1L;

	private String appName;
	private String timeStamp;
	private String logLevel;
	private String shortMsg;
	private String longMsg;
	
	public LogMessage(String appName, String timeStamp, String logLevel,
			String shortMsg, String longMsg) {
		setAppName(appName);
		setTimeStamp(timeStamp);
		setLogLevel(logLevel);
		setShortMsg(shortMsg);
		setLongMsg(longMsg);
	}

	public String getAppName() {
		return appName;
	}
	public void setAppName(String appName) {
		this.appName = appName;
	}
	public String getTimeStamp() {
		return timeStamp;
	}
	public void setTimeStamp(String timeStamp) {
		this.timeStamp = timeStamp;
	}
	public String getLogLevel() {
		return logLevel;
	}
	public void setLogLevel(String logLevel) {
		this.logLevel = logLevel;
	}
	public String getShortMsg() {
		return shortMsg;
	}
	public void setShortMsg(String shortMsg) {
		this.shortMsg = shortMsg;
	}
	public String getLongMsg() {
		return longMsg;
	}
	public void setLongMsg(String longMsg) {
		this.longMsg = longMsg;
	}
	
	public String asXml() {
		StringBuffer sb = new StringBuffer();
		
		sb.append("<LogMessage>")
			.append("<appName>"+getAppName()).append("</appName>")
			.append("<timeStamp>"+getTimeStamp()).append("</timeStamp>")
			.append("<logLevel>"+getLogLevel()).append("</logLevel>")
			.append("<shortMsg>"+getShortMsg()).append("</shortMsg>")
			.append("<longMsg>"+getLongMsg()).append("</longMsg>")
			.append("</LogMessage>");

		return sb.toString();
	}

	public String toString() {
		StringBuffer sb = new StringBuffer();
		
		sb.append("LogMessage {")
			.append("appName="+getAppName()).append(", ")
			.append("timeStamp="+getTimeStamp()).append(", ")
			.append("logLevel="+getLogLevel()).append(", ")
			.append("shortMsg="+getShortMsg()).append(", ")
			.append("longMsg="+getLongMsg())
			.append("}");

		return sb.toString();
	}

}
