Package com.github.loki4j.logback.json
Class KeyValuePairsJsonProvider
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- com.github.loki4j.logback.json.AbstractJsonProvider
-
- com.github.loki4j.logback.json.AbstractFieldCollectionJsonProvider<java.lang.Object,org.slf4j.event.KeyValuePair,java.util.List<org.slf4j.event.KeyValuePair>>
-
- com.github.loki4j.logback.json.KeyValuePairsJsonProvider
-
- All Implemented Interfaces:
ch.qos.logback.core.spi.ContextAware,ch.qos.logback.core.spi.LifeCycle,JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent>
public class KeyValuePairsJsonProvider extends AbstractFieldCollectionJsonProvider<java.lang.Object,org.slf4j.event.KeyValuePair,java.util.List<org.slf4j.event.KeyValuePair>>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFIELD_KVP_PREFIX
-
Constructor Summary
Constructors Constructor Description KeyValuePairsJsonProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<org.slf4j.event.KeyValuePair>extractEntries(ch.qos.logback.classic.spi.ILoggingEvent event)Extract the collection of entries (i.e.protected java.lang.StringextractKey(org.slf4j.event.KeyValuePair entry)Extract the key (i.e.protected java.lang.ObjectextractValue(org.slf4j.event.KeyValuePair entry)Extract the value (i.e.JsonFieldSerializer<java.lang.Object>getFieldSerializer()voidsetFieldSerializer(JsonFieldSerializer<java.lang.Object> fieldSerializer)protected voidwriteField(JsonEventWriter writer, java.lang.String fieldName, java.lang.Object fieldValue)Write a field into JSON event layout.-
Methods inherited from class com.github.loki4j.logback.json.AbstractFieldCollectionJsonProvider
addExclude, addInclude, canWrite, getPrefix, isNoPrefix, setNoPrefix, setPrefix, writeTo
-
Methods inherited from class com.github.loki4j.logback.json.AbstractJsonProvider
isEnabled, isStarted, setEnabled, start, stop
-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
-
-
-
Field Detail
-
FIELD_KVP_PREFIX
public static final java.lang.String FIELD_KVP_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
extractEntries
protected java.util.List<org.slf4j.event.KeyValuePair> extractEntries(ch.qos.logback.classic.spi.ILoggingEvent event)
Description copied from class:AbstractFieldCollectionJsonProviderExtract the collection of entries (i.e. fields) from the logging event.- Specified by:
extractEntriesin classAbstractFieldCollectionJsonProvider<java.lang.Object,org.slf4j.event.KeyValuePair,java.util.List<org.slf4j.event.KeyValuePair>>- Parameters:
event- Current logback event.
-
extractKey
protected java.lang.String extractKey(org.slf4j.event.KeyValuePair entry)
Description copied from class:AbstractFieldCollectionJsonProviderExtract the key (i.e. field name) from the collection entry.- Specified by:
extractKeyin classAbstractFieldCollectionJsonProvider<java.lang.Object,org.slf4j.event.KeyValuePair,java.util.List<org.slf4j.event.KeyValuePair>>
-
extractValue
protected java.lang.Object extractValue(org.slf4j.event.KeyValuePair entry)
Description copied from class:AbstractFieldCollectionJsonProviderExtract the value (i.e. field value) from the collection entry.- Specified by:
extractValuein classAbstractFieldCollectionJsonProvider<java.lang.Object,org.slf4j.event.KeyValuePair,java.util.List<org.slf4j.event.KeyValuePair>>
-
writeField
protected void writeField(JsonEventWriter writer, java.lang.String fieldName, java.lang.Object fieldValue)
Description copied from class:AbstractFieldCollectionJsonProviderWrite a field into JSON event layout.- Specified by:
writeFieldin classAbstractFieldCollectionJsonProvider<java.lang.Object,org.slf4j.event.KeyValuePair,java.util.List<org.slf4j.event.KeyValuePair>>- Parameters:
writer- JSON writer to use.fieldName- Name of the field to write.fieldValue- Value of the field to write.
-
getFieldSerializer
public JsonFieldSerializer<java.lang.Object> getFieldSerializer()
-
setFieldSerializer
public void setFieldSerializer(JsonFieldSerializer<java.lang.Object> fieldSerializer)
-
-