net.sourceforge.acelogger.formatter
Class BaseFormatter

java.lang.Object
  extended by net.sourceforge.acelogger.formatter.BaseFormatter
All Implemented Interfaces:
Formatter, Identifiable
Direct Known Subclasses:
MessageOnlyFormatter, PatternFormatter, SimpleFormatter

public abstract class BaseFormatter
extends Object
implements Formatter

Abstracts all common tasks for Formatter.

Since:
1.0.0
Version:
1.0.0
Author:
Zardi (https://sourceforge.net/users/daniel_zardi)

Field Summary
 
Fields inherited from interface net.sourceforge.acelogger.formatter.Formatter
NO_FORMATTER
 
Constructor Summary
BaseFormatter(String identifier, TextInterpolator interpolator)
          Constructs a new BaseFormatter with the supplied identifier.
 
Method Summary
protected  String formatMessage(String message, Object... params)
          Formats a message filling it with the supplied parameters, this method is just a convenient way to format messages without the need to catch a IllegalArgumentException.
protected  String formatStackTrace(Throwable cause)
          Formats a string representing a stack trace based on the passed Throwable.
 String getIdentifier()
          Gets a String that identifies this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.acelogger.formatter.Formatter
formatLogCall
 

Constructor Detail

BaseFormatter

public BaseFormatter(String identifier,
                     TextInterpolator interpolator)
Constructs a new BaseFormatter with the supplied identifier.

Parameters:
identifier - The string that identifies this formatter.
interpolator - The interpolator to be used by this formatter.
Since:
1.0.0
Method Detail

getIdentifier

public final String getIdentifier()
Gets a String that identifies this object.

Specified by:
getIdentifier in interface Identifiable
Returns:
The identifier of this object.

formatMessage

protected String formatMessage(String message,
                               Object... params)
Formats a message filling it with the supplied parameters, this method is just a convenient way to format messages without the need to catch a IllegalArgumentException.

Parameters:
message - The message to be filled with parameters, the format is dependent of the interpolator used.
params - The parameters that will be used to fill-in the message.
Returns:
A string representing the supplied messages filled with parameters.
Since:
1.0.0
See Also:
TextInterpolator.interpolate(String, Object...)

formatStackTrace

protected String formatStackTrace(Throwable cause)
Formats a string representing a stack trace based on the passed Throwable.

Parameters:
cause - The throwable to get the stack trace.
Returns:
A string representing the stack trace of this throwable.
Since:
1.0.0


Copyright © 2007-2010 The AceLogger Team. All Rights Reserved.