org.hackystat.utilities.logger
Class OneLineFormatter

java.lang.Object
  extended by java.util.logging.Formatter
      extended by org.hackystat.utilities.logger.OneLineFormatter

public class OneLineFormatter
extends java.util.logging.Formatter

Provides a one line formatter for use with Hackystat logging. Supports optional date stamp prefix and optional appending of a newline.

Author:
Philip Johnson

Constructor Summary
OneLineFormatter()
          Default constructor that enables the date stamp and new line.
OneLineFormatter(boolean enableDateStamp)
          One line format string with optional date stamp.
OneLineFormatter(boolean enableDateStamp, boolean enableNewline)
          One line format string with optional date stamp and optional newline.
 
Method Summary
 java.lang.String format(java.util.logging.LogRecord record)
          Formats the passed log string as a single line.
 
Methods inherited from class java.util.logging.Formatter
formatMessage, getHead, getTail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneLineFormatter

public OneLineFormatter()
Default constructor that enables the date stamp and new line.


OneLineFormatter

public OneLineFormatter(boolean enableDateStamp)
One line format string with optional date stamp. Always adds a newline.

Parameters:
enableDateStamp - If true, a date stamp is inserted.

OneLineFormatter

public OneLineFormatter(boolean enableDateStamp,
                        boolean enableNewline)
One line format string with optional date stamp and optional newline.

Parameters:
enableDateStamp - If true, a date stamp is inserted.
enableNewline - If true, a newline is always inserted.
Method Detail

format

public java.lang.String format(java.util.logging.LogRecord record)
Formats the passed log string as a single line. Prefixes the log string with a date stamp if enabled, and adds a newline if enabled.

Specified by:
format in class java.util.logging.Formatter
Parameters:
record - A log record.
Returns:
The message string.