public abstract class LogstashMarker extends Object implements Iterable<org.slf4j.Marker>
Marker
that is known and understood by the logstash logback encoder.
In particular these markers are used to write data into the logstash json event via writeTo(JsonGenerator)
.
Modifier and Type | Field and Description |
---|---|
static String |
MARKER_NAME_PREFIX |
Constructor and Description |
---|
LogstashMarker(String name) |
Modifier and Type | Method and Description |
---|---|
void |
add(org.slf4j.Marker reference) |
<T extends LogstashMarker> |
and(org.slf4j.Marker reference)
Adds the given marker as a reference, and returns this marker.
|
boolean |
contains(org.slf4j.Marker other) |
boolean |
contains(String name) |
boolean |
equals(Object obj) |
String |
getName() |
boolean |
hasChildren()
Deprecated.
|
int |
hashCode() |
boolean |
hasReferences() |
Iterator<org.slf4j.Marker> |
iterator() |
boolean |
remove(org.slf4j.Marker referenceToRemove) |
String |
toString()
Returns a String in the form of
|
protected String |
toStringSelf()
Returns a string representation of this object, without including any references.
|
<T extends LogstashMarker> |
with(org.slf4j.Marker reference)
Deprecated.
Use
and(Marker) instead |
abstract void |
writeTo(JsonGenerator generator)
Writes the data associated with this marker to the given
JsonGenerator . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, iterator, spliterator
public static final String MARKER_NAME_PREFIX
public LogstashMarker(String name)
public <T extends LogstashMarker> T and(org.slf4j.Marker reference)
This can be used to chain markers together fluently on a log line. For example:
import static net.logstash.logback.marker.Markers.*
logger.info(append("name1", "value1).and(append("name2", "value2")), "log message");
T
- subtype of LogstashMarkerreference
- The marker to add@Deprecated public <T extends LogstashMarker> T with(org.slf4j.Marker reference)
and(Marker)
insteadT
- subtype of LogstashMarkerreference
- The marker to addand(Marker)
public abstract void writeTo(JsonGenerator generator) throws IOException
JsonGenerator
.generator
- the generator to which to write the output of this marker.IOException
- if there was an error writing to the generatorpublic void add(org.slf4j.Marker reference)
add
in interface org.slf4j.Marker
public String toString()
self, reference1, reference2, ...
Where self
is the value returned by toStringSelf()
,
and reference*
are the toString()
values of any references.
It is recommended that subclasses only override toStringSelf()
,
so that references are automatically included in the value returned from toString()
.
protected String toStringSelf()
Subclasses should override toStringSelf()
instead of toString()
,
since toString()
will automatically include the toStringSelf()
and references.
public String getName()
getName
in interface org.slf4j.Marker
public boolean hasReferences()
hasReferences
in interface org.slf4j.Marker
@Deprecated public boolean hasChildren()
hasChildren
in interface org.slf4j.Marker
public Iterator<org.slf4j.Marker> iterator()
iterator
in interface org.slf4j.Marker
public boolean remove(org.slf4j.Marker referenceToRemove)
remove
in interface org.slf4j.Marker
public boolean contains(org.slf4j.Marker other)
contains
in interface org.slf4j.Marker
public boolean contains(String name)
contains
in interface org.slf4j.Marker
public boolean equals(Object obj)
Copyright © 2013–2022. All rights reserved.