Class KibanaLogFields


  • public final class KibanaLogFields
    extends Object
    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
    Author:
    Rutger Lubbers, Paul Klos
    • Method Detail

      • setLogType

        public static void setLogType​(KibanaLogTypeNames value)
        Set the field KibanaLogTypeNames.LOG_TYPE to the given value.
      • setCallResult

        public static void setCallResult​(KibanaLogCallResultTypes value)
        Set the field KibanaLogTypeNames.LOG_TYPE to the given value.
      • unsetLogType

        public static void unsetLogType()
        Removes the value for the field KibanaLogTypeNames.LOG_TYPE.
      • set

        public static void set​(KibanaLogField field,
                               int value)
        Sets the Kibana log field field to the value.
      • set

        public static void set​(KibanaLogField field,
                               String value)
        Sets the Kibana log field field to the value.
      • get

        public static String get​(KibanaLogField field)
        Retrieves the value for the field. It will return null if no value is set.
      • getOrDefault

        public static String getOrDefault​(KibanaLogField field,
                                          String defaultValue)
        Retrieves the value for the field. It will return defaultValue if no value is set.
      • unset

        public static void unset​(KibanaLogField field)
        Removes the value for the field field.
      • clear

        public static void clear()
        Removes all values set for all fields.
      • getValuesAsLogString

        public static String getValuesAsLogString()
        Getter for the log string.
        Returns:
        the log string
      • populateFromContext

        public static void populateFromContext​(KibanaLogContext logContext)
        Update log fields based on the KibanaLogContext.

        See getContext().