@MinDoc(copyright="Copyright 2001 - 2002, 2009 A. Weinert", author="Albrecht Weinert", version="V.39", lastModified="17.04.2021", usage="use for (java.) logging", purpose="a formatter for log messages (as text)") public class LogTextFormatter extends Formatter
Formatter
, suitable for the
logging
API's
Handler
like e.g.
LogWriterHandler
.LogRecord
s into a simple human
readable text format.TextHelper
,
TimeHelper
Modifier and Type | Field and Description |
---|---|
protected String |
head
Header for this Formatter's output.
|
protected String |
tail
End text for this Formatter's output.
|
protected String |
wedaclock
(Nationalised) time format.
|
Constructor and Description |
---|
LogTextFormatter(CharSequence head,
CharSequence tail)
Make a formatter (LogRecord -> Text).
|
Modifier and Type | Method and Description |
---|---|
String |
format(LogRecord record)
Formatting a LogRecord in readable text format.
|
String |
formatMessage(LogRecord record)
Formatting a message.
|
static StringBuilder |
formatMessage(StringBuilder bastel,
LogRecord record)
Formatting a message.
|
String |
getHead(Handler h)
Header for this Formatter's output.
|
String |
getTail(Handler h)
End text for this Formatter's output.
|
String |
getTimeFormat()
(Nationalised) time format.
|
protected String head
protected String tail
protected transient String wedaclock
getTimeFormat()
public LogTextFormatter(CharSequence head, CharSequence tail)
public String getHead(Handler h)
ComVar.EMPTY_STRING
public String getTail(Handler h)
ComVar.EMPTY_STRING
public static StringBuilder formatMessage(StringBuilder bastel, LogRecord record)
LogRecord
's (record
's)
message
) remains unchanged if null or
empty. Otherwise it is tried to interpret it as a key for a language
specific report or message format (AppLangMap
.valueUL(message, message)
).TextHelper
.messageFormat(..)
) it is returned as (now) is. The same applies if
record has no or an empty parameter entry
(LogRecord.getParameters()
).TextHelper
.messageFormat(..)
) and the result will be returned.StringBuilder
supplied or newly generated.format(LogRecord)
.record
- the log entry with the plain (raw) messagebastel
- the builder to append to. If null made with start
capacity 99AppLangMap
,
AppLangMap.valueUL(CharSequence, String)
public final String formatMessage(LogRecord record)
formatMessage
in class Formatter
public final String getTimeFormat()
public String format(LogRecord record)