- All Superinterfaces:
LogFormatter
- All Known Implementing Classes:
LogFormatter.NoopFormatter
- Enclosing interface:
LogFormatter
public static sealed interface LogFormatter.TimestampFormatter
extends LogFormatter
permits LogFormatter.NoopFormatter (not exhaustive)
Formats event timestamps.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jstach.rainbowgum.LogFormatter
LogFormatter.Builder, LogFormatter.EventFormatter, LogFormatter.LevelFormatter, LogFormatter.NoopFormatter, LogFormatter.StaticFormatter, LogFormatter.ThrowableFormatter, LogFormatter.TimestampFormatter
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default timestamp format used in many logging frameworks which does not have dates and only time at millisecond precision. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
format
(StringBuilder output, LogEvent event) Formats a log event.void
formatTimestamp
(StringBuilder output, Instant instant) Format timestamp.of()
Formats timestamp usingTTLL_TIME_FORMAT
.of
(DateTimeFormatter dateTimeFormatter) Formats a timestamp using standard JDK date time formatter.ofISO()
Formats a timestamp using ISO format.ofMicros()
Micro seconds over the events last second.Methods inherited from interface io.jstach.rainbowgum.LogFormatter
isNoop
-
Field Details
-
TTLL_TIME_FORMAT
The default timestamp format used in many logging frameworks which does not have dates and only time at millisecond precision.It is called TTLL as that is the name of the format where it is used in logback, log4j etc.
- See Also:
-
-
Method Details
-
formatTimestamp
Format timestamp.- Parameters:
output
- buffer.instant
- timestamp.
-
format
Description copied from interface:LogFormatter
Formats a log event.- Specified by:
format
in interfaceLogFormatter
- Parameters:
output
- buffer.event
- log event.- See Also:
-
of
Formats timestamp usingTTLL_TIME_FORMAT
.- Returns:
- formatter.
-
ofISO
Formats a timestamp using ISO format.- Returns:
- formatter.
-
ofMicros
Micro seconds over the events last second. This is for logback compatibility.- Returns:
- microseconds zero padded.
-
of
Formats a timestamp using standard JDK date time formatter.- Parameters:
dateTimeFormatter
- date time formatter.- Returns:
- timestamp formatter.
-