package com.dtstack.logstash.outputs;

import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * 
 * Reason: TODO ADD REASON(可选)
 * Date: 2016年8月31日 下午1:36:42
 * Company: www.dtstack.com
 * @author sishu.yss
 *
 */
public class Stdout extends BaseOutput {
	
	private static final Logger logger = LoggerFactory.getLogger(Stdout.class);

	public Stdout(Map config) {
		super(config);
	}

	@Override
	public void prepare() {

	}

	@Override
	protected void emit(Map event) {
		System.out.println(event);
	}
}

@@ -54,16 +54,84 @@
 il.Map;%0A
+import java.util.Set;%0Aimport org.codehaus.jackson.map.ObjectMapper;%0A
 import o
@@ -299,16 +299,30 @@
 shu.yss%0A
+ * @param %3CE%3E%0A
  *%0A */%0Ap
@@ -360,17 +360,16 @@
 Output %7B
-%0A
 %09%0A%09priva
@@ -443,173 +443,1009 @@
 s);%0A
-%0A%09public Stdout(Map config) %7B%0A%09%09super(config);%0A%09%7D%0A%0A%09@Override%0A%09public void prepare() %7B%0A%0A%09%7D%0A%0A%09@Override%0A%09protected void emit(Map event) %7B%0A%09%09System.out.println(event);
+%09%0A%09private static String codec=%22line%22;%0A%09%0A%09private static ObjectMapper objectMapper = new ObjectMapper();%0A%09%0A%09private static String tempalte=%22%5C%22%25s%5C%22 =%3E %5C%22%25s%5C%22,%22+System.getProperty(%22line.separator%22);%0A%0A%09public Stdout(Map config) %7B%0A%09%09super(config);%0A%09%7D%0A%0A%09@Override%0A%09public void prepare() %7B%0A%0A%09%7D%0A%0A%09@Override%0A%09protected void emit(Map event) %7B%0A%09%09try%7B%0A%09%09%09if (codec.equals(%22line%22))%7B%0A%09%09%09%09System.out.println(event.get(%22message%22));%0A%09%09%09%7Delse if(codec.equals(%22json_lines%22))%7B%0A%09%09%09%09System.out.println(objectMapper.writeValueAsString(event));%0A%09%09%09%7Delse if(codec.equals(%22java_lines%22))%7B%0A%09%09%09%09StringBuilder sb = new StringBuilder();%0A%09%09%09%09sb.append(%22%7B%22).append(System.getProperty(%22line.separator%22));%0A%09%09%09%09Set%3CMap.Entry%3CString, Object%3E%3E entrys=event.entrySet();%0A%09%09%09%09for(Map.Entry%3CString, Object%3E entry:entrys)%7B%0A%09%09%09%09%09sb.append(String.format(tempalte, entry.getKey(),entry.getValue()));%0A%09%09%09%09%7D%0A%09%09%09%09sb.append(%22%7D%22);%0A%09%09%09%09System.out.println(sb.toString());%0A%09%09%09%7D%0A%09%09%7Dcatch(Exception e)%7B%0A%09%09%09logger.error(%22Stdout emit erro%22,e.getCause());%0A%09%09%7D
 %0A%09%7D%0A

Update Stdout.java