to top
Android APIs
public abstract class

Formatter

extends Object
java.lang.Object
   ↳ java.util.logging.Formatter
Known Direct Subclasses

Class Overview

Formatter objects are used to format LogRecord objects into a string representation. Head and tail strings are sometimes used to wrap a set of records. The getHead and getTail methods are used for this purpose.

Summary

Protected Constructors
Formatter()
Constructs a Formatter object.
Public Methods
abstract String format( LogRecord r)
Converts a LogRecord object into a string representation.
String formatMessage( LogRecord r)
Formats a LogRecord object into a localized string representation.
String getHead( Handler h)
Gets the head string used to wrap a set of log records.
String getTail( Handler h)
Gets the tail string used to wrap a set of log records.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected Formatter ()

Added in API level 1

Constructs a Formatter object.

Public Methods

public abstract String format (LogRecord r)

Added in API level 1

Converts a LogRecord object into a string representation. The resulted string is usually localized and includes the message field of the record.

Parameters
r the log record to be formatted into a string.
Returns
  • the formatted string.

public String formatMessage (LogRecord r)

Added in API level 1

Formats a LogRecord object into a localized string representation. This is a convenience method for subclasses of Formatter.

The message string is firstly localized using the ResourceBundle object associated with the supplied LogRecord.

Notice : if message contains "{0", then java.text.MessageFormat is used. Otherwise no formatting is performed.

Parameters
r the log record to be formatted.
Returns
  • the string resulted from the formatting.

public String getHead (Handler h)

Added in API level 1

Gets the head string used to wrap a set of log records. This base class always returns an empty string.

Parameters
h the target handler.
Returns
  • the head string used to wrap a set of log records, empty in this implementation.

public String getTail (Handler h)

Added in API level 1

Gets the tail string used to wrap a set of log records. This base class always returns the empty string.

Parameters
h the target handler.
Returns
  • the tail string used to wrap a set of log records, empty in this implementation.
No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.