1 package org.jzonic.jlo.formatter; 2 3 import org.jzonic.jlo.LogRecord; 4 import org.jzonic.jlo.formatter.tokens.TokenParser; 5 6 import java.util.Map ; 7 8 22 public class DefinedFormatter extends AbstractFormatter { 23 24 private String format = "${date} ${time} : [${target}] [${class}] ${text}"; 25 26 public DefinedFormatter(String configName) { 27 super(configName); 28 } 29 30 36 public String formatMessage(LogRecord lr) { 37 TokenParser tp = new TokenParser(); 38 return tp.parseLine(lr,format); 39 } 40 41 48 public void setParameter(Map params) { 49 if ( params.containsKey("format")) { 50 format = (String )params.get("format"); 51 } 52 } 53 } 54 | Popular Tags |