Errai 3.0.1-SNAPSHOT

org.jboss.errai.common.client.logging.formatters
Class ErraiSimpleFormatter

java.lang.Object
  extended by java.util.logging.Formatter
      extended by org.jboss.errai.common.client.logging.formatters.ErraiSimpleFormatter

public class ErraiSimpleFormatter
extends Formatter

Emulates the behaviour of SimpleFormatter, but the format string is stored as a JSNI value.

Author:
Max Barkley
See Also:
setSimpleFormatString(String)

Field Summary
static String defaultFormat
           
 
Constructor Summary
ErraiSimpleFormatter()
           
ErraiSimpleFormatter(String customFormat)
           
 
Method Summary
 String format(LogRecord record)
           
static String getSimpleFormatString()
           
 String getSimpleFormatString(String customFormat)
           
static void setSimpleFormatString(String format)
          Set the value for the format string used by all ErraiSimpleFormatter instances.
 
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
 

Field Detail

defaultFormat

public static final String defaultFormat
See Also:
Constant Field Values
Constructor Detail

ErraiSimpleFormatter

public ErraiSimpleFormatter()

ErraiSimpleFormatter

public ErraiSimpleFormatter(String customFormat)
Method Detail

format

public String format(LogRecord record)
Specified by:
format in class Formatter

setSimpleFormatString

public static void setSimpleFormatString(String format)
Set the value for the format string used by all ErraiSimpleFormatter instances. The provided format string is called with StringFormat like so:
    StringFormat.format(formatString, date, fullLoggerName, simpleLoggerName, level, throwable)
 
The parameters are as follows: The call to StringFormat.format(String, Object...) is designed to mimic the call to String.format(String, Object...) in SimpleFormatter, however there are some differences. Please see StringFormat.format(String, Object...) for details.

Parameters:
format - The format string for used by all ErraiSimpleFormatter instances.

getSimpleFormatString

public static String getSimpleFormatString()
Returns:
The global format string.
See Also:
setSimpleFormatString(String)

getSimpleFormatString

public String getSimpleFormatString(String customFormat)
Parameters:
customFormat - the custom format provided when creating this formatter (see ErraiSimpleFormatter(String))
Returns:
The custom format string, if provided, otherwise the global format string, or default format if no global format has been set.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.