package demo.transformers;

import org.mule.api.transformer.TransformerException;
import org.mule.transformer.AbstractTransformer;

import demo.domain.LogMessage;

public class LogMessageToSmsString extends AbstractTransformer {

	@Override
	protected Object doTransform(Object src, String encoding)
			throws TransformerException {

		LogMessage lm = (LogMessage) src;

		StringBuffer sb = new StringBuffer();
		sb.append("LogMessage rcvd:\n")
			.append("app: "+lm.getAppName()).append("\n")
			.append("time: "+lm.getTimeStamp()).append("\n")
			.append("level: "+lm.getLogLevel()).append("\n")
			.append("msg: "+lm.getShortMsg()).append("\n");

		return sb.toString();
	}

}
