Package org.wildfly.event.logger
Class JsonEventFormatter.Builder
- java.lang.Object
-
- org.wildfly.event.logger.JsonEventFormatter.Builder
-
- Enclosing class:
- JsonEventFormatter
public static class JsonEventFormatter.Builder extends Object
Builder used to create theJsonEventFormatter.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonEventFormatter.BuilderaddMetaData(String key, Object value)Adds meta-data to the final output.JsonEventFormatter.BuilderaddMetaData(Map<String,Object> metaData)Adds meta-data to the final output.JsonEventFormatterbuild()Creates theJsonEventFormatter.JsonEventFormatter.BuildersetIncludeTimestamp(boolean includeTimestamp)Sets whether or not the timestamp should be added to the output.JsonEventFormatter.BuildersetTimestampFormatter(DateTimeFormatter formatter)Set the formatter used to format the timestamp on the event.JsonEventFormatter.BuildersetTimestampKey(String timestampKey)Sets the key for the timestamp for the event.JsonEventFormatter.BuildersetZoneId(ZoneId zoneId)Set the zone id for the timestamp.
-
-
-
Method Detail
-
addMetaData
public JsonEventFormatter.Builder addMetaData(String key, Object value)
Adds meta-data to the final output.- Parameters:
key- the key to addvalue- the value for the key- Returns:
- this builder
-
addMetaData
public JsonEventFormatter.Builder addMetaData(Map<String,Object> metaData)
Adds meta-data to the final output.- Parameters:
metaData- the meta-data to add- Returns:
- this builder
-
setTimestampKey
public JsonEventFormatter.Builder setTimestampKey(String timestampKey)
Sets the key for the timestamp for the event. The default istimestamp.- Parameters:
timestampKey- the key name ornullto revert to the default- Returns:
- this builder
-
setTimestampFormatter
public JsonEventFormatter.Builder setTimestampFormatter(DateTimeFormatter formatter)
Set the formatter used to format the timestamp on the event. The default is ISO-8601.- Parameters:
formatter- the formatter to use ornullto revert to the default.- Returns:
- this builder
-
setZoneId
public JsonEventFormatter.Builder setZoneId(ZoneId zoneId)
Set the zone id for the timestamp. The default isZoneId.systemDefault().- Parameters:
zoneId- the zone id to use ornullto revert to the default- Returns:
- this builder
-
setIncludeTimestamp
public JsonEventFormatter.Builder setIncludeTimestamp(boolean includeTimestamp)
Sets whether or not the timestamp should be added to the output. The default istrue. If set tofalsethe zone id and format are ignored.- Parameters:
includeTimestamp-trueto include the timestamp orfalseto leave the timestamp off- Returns:
- this builder
-
build
public JsonEventFormatter build()
Creates theJsonEventFormatter.- Returns:
- the newly created formatter
-
-