Class KeyValueParameter
java.lang.Object
eu.mulk.quarkus.googlecloud.jsonlogging.KeyValueParameter
- All Implemented Interfaces:
StructuredParameter
A simple single key–value pair forming a
StructuredParameter.
This class is suitable for the common case of logging a key–value pair as parameter to the
*f family of logging functions on Logger. For advanced use
cases, provide your own implementation of StructuredParameter.
Example:
logger.infof("Application starting.", StructuredParameter.of("version", "1.0"));
Result:
{
"jsonPayload": {
"message": "Application starting.",
"version": "1.0"
}
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()jakarta.json.JsonObjectBuilderjson()The JSON to be embedded in the payload of the log entry.key()The key part of the key–value pair.static KeyValueParameterCreates aKeyValueParameterfrom abooleanvalue.static KeyValueParameterCreates aKeyValueParameterfrom adoublevalue.static KeyValueParameterCreates aKeyValueParameterfrom anintvalue.static KeyValueParameterCreates aKeyValueParameterfrom alongvalue.static KeyValueParameterCreates aKeyValueParameterfrom aStringvalue.static KeyValueParameterof(String key, BigDecimal value) Creates aKeyValueParameterfrom aBigDecimalvalue.static KeyValueParameterof(String key, BigInteger value) Creates aKeyValueParameterfrom aBigIntegervalue.toString()jakarta.json.JsonValuevalue()The value part of the key–value pair.
-
Method Details
-
of
- Parameters:
key- the key part of the key–value pair.value- the value part of the key–value pair.- Returns:
- the newly constructed parameter, ready to be passed to a logging function.
-
of
- Parameters:
key- the key part of the key–value pair.value- the value part of the key–value pair.- Returns:
- the newly constructed parameter, ready to be passed to a logging function.
-
of
- Parameters:
key- the key part of the key–value pair.value- the value part of the key–value pair.- Returns:
- the newly constructed parameter, ready to be passed to a logging function.
-
of
- Parameters:
key- the key part of the key–value pair.value- the value part of the key–value pair.- Returns:
- the newly constructed parameter, ready to be passed to a logging function.
-
of
- Parameters:
key- the key part of the key–value pair.value- the value part of the key–value pair.- Returns:
- the newly constructed parameter, ready to be passed to a logging function.
-
of
- Parameters:
key- the key part of the key–value pair.value- the value part of the key–value pair.- Returns:
- the newly constructed parameter, ready to be passed to a logging function.
-
of
- Parameters:
key- the key part of the key–value pair.value- the value part of the key–value pair.- Returns:
- the newly constructed parameter, ready to be passed to a logging function.
-
json
public jakarta.json.JsonObjectBuilder json()Description copied from interface:StructuredParameterThe JSON to be embedded in the payload of the log entry.May contain multiple keys and values as well as nested objects. Each top-level entry of the returned object is embedded as a top-level entry in the payload of the log entry.
- Specified by:
jsonin interfaceStructuredParameter- Returns:
- A
JsonObjectBuilderholding a set of key–value pairs.
-
key
The key part of the key–value pair.- Returns:
- the key part of the key–value pair.
-
value
public jakarta.json.JsonValue value()The value part of the key–value pair.Can be of any non-composite JSON type (i.e.
string,number, orboolean).- Returns:
- the value pairt of the key–value pair.
-
equals
-
hashCode
public int hashCode() -
toString
-