01: package org.jzonic.jlo.formatter.tokens;
02:
03: import org.jzonic.jlo.LogRecord;
04:
05: import java.text.SimpleDateFormat;
06: import java.util.Date;
07:
08: /**
09: * User: Mecky
10: * Date: 19.07.2005
11: * Time: 12:17:49
12: */
13: public class DateToken implements FormatterToken {
14:
15: private String df = "yyyy/MM/dd HH:mm:ss";
16:
17: public String format(LogRecord lr) {
18: SimpleDateFormat formatter = new SimpleDateFormat(df);
19: Date currentTime = new Date();
20: String dateString = formatter.format(currentTime);
21: return dateString;
22: }
23:
24: public String getName() {
25: return "date";
26: }
27:
28: public void setParameterString(String txt) {
29: df = txt;
30: }
31: }
|