org.jboss.errai.common.client.logging.formatters
Class ErraiSimpleFormatter
java.lang.Object
java.util.logging.Formatter
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)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultFormat
public static final String defaultFormat
- See Also:
- Constant Field Values
ErraiSimpleFormatter
public ErraiSimpleFormatter()
ErraiSimpleFormatter
public ErraiSimpleFormatter(String customFormat)
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:
formatString
: the format string (see
StringFormat.format(String, Object...)
for details).
date
: the log date, either a Long
or Date
.
fullLoggerName
: the full name of the logger.
simpleLoggerName
: a substring of the full logger name, starting
after the last '.', or the full name if no '.' occurs (i.e. "a.b.c" -->
"c", "abc" --> "abc").
level
: the level of the this log entry (i.e. TRACE, DEBUG,
INFO, WARN, ERROR).
throwable
: the throwable
accompanying this log entry,
or null
if none provided.
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.
Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.