public class StructuredArguments extends Object
StructuredArguments.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_KEY_VALUE_MESSAGE_FORMAT_PATTERN
The default message format used when writing key value pairs to the log message.
|
static String |
VALUE_ONLY_MESSAGE_FORMAT_PATTERN
A message format pattern that will only write
the argument value to a log message (i.e.
|
| Modifier and Type | Method and Description |
|---|---|
static StructuredArgument |
a(String fieldName,
Object... objects)
Abbreviated convenience method for calling
array(String, Object...). |
static StructuredArgument |
array(String fieldName,
Object... objects)
Adds a field to the JSON event whose key is
fieldName and whose value
is a JSON array of objects AND a string version of the array to the formatted message. |
static StructuredArgument |
defer(Supplier<? extends StructuredArgument> structuredArgumentSupplier)
Defer the evaluation of the argument until actually required.
|
static StructuredArgument |
e(Map<?,?> map)
Abbreviated convenience method for calling
entries(Map). |
static StructuredArgument |
entries(Map<?,?> map)
Adds a "key":"value" entry for each Map entry to the JSON event AND
map.toString() to the formatted message. |
static StructuredArgument |
f(Object object)
Abbreviated convenience method for calling
fields(Object). |
static StructuredArgument |
fields(Object object)
Adds a "key":"value" entry for each field in the given object to the JSON event AND
object.toString() to the formatted message. |
static StructuredArgument |
keyValue(String key,
Object value)
Convenience method for calling
keyValue(String, Object, String)
using the DEFAULT_KEY_VALUE_MESSAGE_FORMAT_PATTERN. |
static StructuredArgument |
keyValue(String key,
Object value,
String messageFormatPattern)
Adds "key":"value" to the JSON event AND
name/value to the formatted message using the given messageFormatPattern.
|
static StructuredArgument |
kv(String key,
Object value)
Abbreviated convenience method for calling
keyValue(String, Object). |
static StructuredArgument |
kv(String key,
Object value,
String messageFormatPattern)
Abbreviated convenience method for calling
keyValue(String, Object, String). |
static StructuredArgument |
r(String fieldName,
String rawJsonValue)
Abbreviated convenience method for calling
raw(String, String). |
static StructuredArgument |
raw(String fieldName,
String rawJsonValue)
Adds the
rawJsonValue to the JSON event AND
the rawJsonValue to the formatted message. |
static String |
toString(Object arg)
Format the argument into a string.
|
static StructuredArgument |
v(String key,
Object value)
Abbreviated convenience method for calling
value(String, Object). |
static StructuredArgument |
value(String key,
Object value)
Adds "key":"value" to the JSON event AND
value to the formatted message (without the key).
|
public static final String DEFAULT_KEY_VALUE_MESSAGE_FORMAT_PATTERN
public static final String VALUE_ONLY_MESSAGE_FORMAT_PATTERN
public static StructuredArgument keyValue(String key, Object value)
keyValue(String, Object, String)
using the DEFAULT_KEY_VALUE_MESSAGE_FORMAT_PATTERN.
Basically, adds "key":"value" to the JSON event AND name=value to the formatted message.
key - the key (field name)value - the valueStructuredArgument instanceObjectAppendingMarker,
keyValue(String, Object, String),
DEFAULT_KEY_VALUE_MESSAGE_FORMAT_PATTERNpublic static StructuredArgument kv(String key, Object value)
keyValue(String, Object).key - the key (field name)value - the valueStructuredArgument instancekeyValue(String, Object)public static StructuredArgument keyValue(String key, Object value, String messageFormatPattern)
key - the key (field name)value - the valuemessageFormatPattern - the pattern used to concatenate the key and the valueStructuredArgument instanceObjectAppendingMarkerpublic static StructuredArgument kv(String key, Object value, String messageFormatPattern)
keyValue(String, Object, String).key - the key (field name)value - the valuemessageFormatPattern - the pattern used to concatenate the key and the valueStructuredArgument instancekeyValue(String, Object, String)public static StructuredArgument value(String key, Object value)
key - the key (field name)value - the valueStructuredArgument instancekeyValue(String, Object, String),
VALUE_ONLY_MESSAGE_FORMAT_PATTERNpublic static StructuredArgument v(String key, Object value)
value(String, Object).key - the key (field name)value - the valueStructuredArgument instancevalue(String, Object)public static StructuredArgument entries(Map<?,?> map)
map.toString() to the formatted message.map - Map holding the key/value pairsStructuredArgument instanceMapEntriesAppendingMarkerpublic static StructuredArgument e(Map<?,?> map)
entries(Map).map - Map holding the key/value pairsStructuredArgument instanceentries(Map)public static StructuredArgument fields(Object object)
object.toString() to the formatted message.object - the object to write fields fromStructuredArgument instanceObjectFieldsAppendingMarkerpublic static StructuredArgument f(Object object)
fields(Object).object - the object to write fields fromStructuredArgument instancefields(Object)public static StructuredArgument array(String fieldName, Object... objects)
fieldName and whose value
is a JSON array of objects AND a string version of the array to the formatted message.fieldName - field nameobjects - elements of the array to write under the fieldName keyStructuredArgument instanceObjectAppendingMarkerpublic static StructuredArgument a(String fieldName, Object... objects)
array(String, Object...).fieldName - field nameobjects - elements of the array to write under the fieldName keyStructuredArgument instancearray(String, Object...)public static StructuredArgument raw(String fieldName, String rawJsonValue)
rawJsonValue to the JSON event AND
the rawJsonValue to the formatted message.fieldName - field namerawJsonValue - the raw JSON valueStructuredArgument instanceRawJsonAppendingMarkerpublic static StructuredArgument r(String fieldName, String rawJsonValue)
raw(String, String).fieldName - field namerawJsonValue - the raw JSON valueStructuredArgument instanceraw(String, String)public static StructuredArgument defer(Supplier<? extends StructuredArgument> structuredArgumentSupplier)
structuredArgumentSupplier - a supplier for the argument valueStructuredArgument instanceDeferredStructuredArgumentpublic static String toString(Object arg)
Arrays.toString(long[]),
non array object using String.valueOf(java.lang.Object).
See org.slf4j.helpers.MessageFormatter#deeplyAppendParameter(StringBuilder, Object, Map)}
arg - the argument to formatCopyright © 2013–2021. All rights reserved.