public abstract class SingleFieldAppendingMarker extends LogstashMarker implements StructuredArgument
Marker OR StructuredArgument that appends
a single field into the JSON event.
When writing to the JSON data (via ArgumentsJsonProvider or LogstashMarkersJsonProvider):
writeFieldName(JsonGenerator),
which just uses fieldName is used as the field namewriteFieldValue(JsonGenerator),
which subclasses must override
When writing to a String (when used as a StructuredArgument to the event's formatted message),
the messageFormatPattern is used to construct the string output.
getFieldName() will be substituted in {0} in the messageFormatPattern.
getFieldValue() will be substituted in {1} in the messageFormatPattern.
Subclasses must override getFieldValue() to provide the field value to include.
| Modifier and Type | Field and Description |
|---|---|
static String |
MARKER_NAME_PREFIX |
| Constructor and Description |
|---|
SingleFieldAppendingMarker(String markerName,
String fieldName) |
SingleFieldAppendingMarker(String markerName,
String fieldName,
String messageFormatPattern) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
String |
getFieldName() |
protected abstract Object |
getFieldValue()
Return the value that should be included in the output of
toString(). |
int |
hashCode() |
String |
toString()
Writes the data associated with this argument to a
String to be
included in a log event's formatted message (via parameter substitution). |
protected void |
writeFieldName(com.fasterxml.jackson.core.JsonGenerator generator)
Writes the field name to the generator.
|
protected abstract void |
writeFieldValue(com.fasterxml.jackson.core.JsonGenerator generator)
Writes the field value to the generator.
|
void |
writeTo(com.fasterxml.jackson.core.JsonGenerator generator)
Writes the data associated with this marker to the given
JsonGenerator. |
and, withadd, contains, contains, getName, hasChildren, hasReferences, iterator, removepublic static final String MARKER_NAME_PREFIX
public String getFieldName()
public void writeTo(com.fasterxml.jackson.core.JsonGenerator generator)
throws IOException
LogstashMarkerJsonGenerator.writeTo in interface StructuredArgumentwriteTo in class LogstashMarkerIOExceptionprotected void writeFieldName(com.fasterxml.jackson.core.JsonGenerator generator)
throws IOException
IOExceptionprotected abstract void writeFieldValue(com.fasterxml.jackson.core.JsonGenerator generator)
throws IOException
IOExceptionpublic String toString()
StructuredArgumentString to be
included in a log event's formatted message (via parameter substitution).
Note that this will only be included in the log event's formatted message if the message format includes a parameter for this argument.
toString in interface StructuredArgumenttoString in class LogstashBasicMarkerprotected abstract Object getFieldValue()
toString().public boolean equals(Object obj)
equals in interface org.slf4j.Markerequals in class LogstashBasicMarkerpublic int hashCode()
hashCode in interface org.slf4j.MarkerhashCode in class LogstashBasicMarkerCopyright © 2018. All rights reserved.