12345678910111213141516171819202122232425262728293031323334 |
- package grafikchat.ohmlogger;
-
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.logging.*;
-
- /**
- * Formatter with custom format
- *
- * @author marian
- */
- class OhmFormatter extends SimpleFormatter {
-
- private static final DateFormat df = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss.SSS");
-
- /**
- * Format message to specified format
- * @param record Tecord to format
- * @return Formatted string
- */
- @Override
- public String format(LogRecord record) {
- StringBuilder builder;
- builder = new StringBuilder(1000);
- builder.append(df.format(new Date(record.getMillis()))).append(" | ");
- builder.append(record.getLevel()).append(" | ");
- builder.append(record.getSourceClassName()).append(" | ");
- builder.append(record.getSourceMethodName()).append(" | ");
- builder.append(formatMessage(record)).append(" |");
- builder.append("\n");
- return builder.toString();
- }
- }
|