View Javadoc

1   package cz.cuni.amis.pogamut.defcon.utils.logging;
2   
3   import java.util.logging.ConsoleHandler;
4   import java.util.logging.Formatter;
5   import java.util.logging.LogRecord;
6   
7   /**
8    * A simple console formatter: LEVEL Message.
9    * 
10   * @author Radek 'Black_Hand' Pibil
11   * 
12   */
13  public class BasicConsoleLogHandler extends ConsoleHandler {
14  
15  	private static final Formatter formatter = new Formatter() {
16  		@Override
17  		public String format(LogRecord rec) {
18  			StringBuffer buf = new StringBuffer(1000);
19  			buf.append(rec.getLevel());
20  			buf.append(' ');
21  			buf.append(rec.getMessage());
22  			buf.append('\n');
23  			return buf.toString();
24  		}
25  	};
26  
27  	public BasicConsoleLogHandler() {
28  		super();
29  		setFormatter(formatter);
30  	}
31  
32  }