Class KibanaLogFields
java.lang.Object
org.hawaiiframework.logging.model.KibanaLogFields
Class that holds the extra fields used for Kibana logging.
Log lines for Kibana will contain all fields set, until the log fields are cleared by invoking
clear().
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Removes all values set for all fields.static voidclear(KibanaLogField field) Removes the value for the fieldfield.static voidclear(KibanaLogField... fields) Removes the value for the fieldsfields.static Stringget(KibanaLogField field) Retrieves the value for thefield.static KibanaLogContextCreate a new log context for the current thread's kibana log fields.static StringgetOrDefault(KibanaLogField field, String defaultValue) Retrieves the value for thefield.static StringGetter for the log string.static voidpopulateFromContext(KibanaLogContext logContext) Update log fields based on theKibanaLogContext.static KibanaLogFieldtag(KibanaLogField field, int value) Sets the Kibana log fieldfieldto thevalue.static KibanaLogFieldtag(KibanaLogField field, Enum<?> value) Sets the Kibana log fieldfieldto thevalue.static KibanaLogFieldtag(KibanaLogField field, String value) Sets the Kibana log fieldfieldto thevalue.static KibanaLogFieldtag(KibanaLogField field, Collection<String> values) Sets the Kibana log fieldfieldto thevalue.static AutoCloseableKibanaLogFieldtagCloseable(KibanaLogField field, int value) Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.static AutoCloseableKibanaLogFieldtagCloseable(KibanaLogField field, Enum<?> value) Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.static AutoCloseableKibanaLogFieldtagCloseable(KibanaLogField field, String value) Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.static AutoCloseableKibanaLogFieldtagCloseable(KibanaLogField field, Collection<String> values) Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.
-
Method Details
-
tag
Sets the Kibana log fieldfieldto thevalue.- Parameters:
field- The field to set.value- The value to set.- Returns:
- The field, set.
-
tag
Sets the Kibana log fieldfieldto thevalue.- Parameters:
field- The field to set.value- The value to set.- Returns:
- The field, set.
-
tag
Sets the Kibana log fieldfieldto thevalue.- Parameters:
field- The field to set.value- The value to set.- Returns:
- The field, set.
-
tag
Sets the Kibana log fieldfieldto thevalue.- Parameters:
field- The field to set.values- The values to set.- Returns:
- The field, set.
-
tagCloseable
Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.- Parameters:
field- The field to set.value- The value to set.- Returns:
- a closable field.
-
tagCloseable
Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.- Parameters:
field- The field to set.value- The value to set.- Returns:
- a closable field.
-
tagCloseable
Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.- Parameters:
field- The field to set.value- The value to set.- Returns:
- a closable field.
-
tagCloseable
public static AutoCloseableKibanaLogField tagCloseable(KibanaLogField field, Collection<String> values) Sets the Kibana log fieldfieldto thevalue, returns an auto closeable.- Parameters:
field- The field to set.values- The value to set.- Returns:
- a closable field.
-
get
Retrieves the value for thefield. It will returnnullif no value is set.- Parameters:
field- The field to retrieve the value for.- Returns:
- The fields value, possibly
null.
-
getOrDefault
Retrieves the value for thefield. It will returndefaultValueif no value is set.- Parameters:
field- The field to retrieve the value for.defaultValue- The value if there is no value set.- Returns:
- The field's value or the default.
-
clear
Removes the value for the fieldfield.- Parameters:
field- The field to remove.
-
clear
Removes the value for the fieldsfields.- Parameters:
fields- The fields to remove the values for.
-
clear
public static void clear()Removes all values set for all fields. -
getValuesAsLogString
Getter for the log string.- Returns:
- the log string
-
populateFromContext
Update log fields based on theKibanaLogContext.See
getContext().- Parameters:
logContext- The context to copy.
-
getContext
Create a new log context for the current thread's kibana log fields.- Returns:
- a log context to use in another thread.
-