public class AndroidHandler extends Handler
Logger
handler that writes to the Android log. The
implementation is rather straightforward. The name of the logger serves as
the log tag. Only the log levels need to be converted appropriately. For
this purpose, the following mapping is being used:
logger level | Android level |
---|---|
SEVERE | ERROR |
WARNING | WARN |
INFO | INFO |
CONFIG | DEBUG |
FINE, FINER, FINEST | VERBOSE |
Constructor and Description |
---|
AndroidHandler()
Constructs a new instance of the Android log handler.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the Handler and free all associated resources.
|
void |
flush()
Flush any buffered output.
|
void |
publish(Logger source,
String tag,
Level level,
String message) |
void |
publish(LogRecord record)
Publish a LogRecord.
|
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
public AndroidHandler()
public void close()
Handler
The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.
public void flush()
Handler
public void publish(LogRecord record)
Handler
The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.
The Handler is responsible for formatting the message, when and if necessary. The formatting should include localization.