Class AbstractFieldJsonProvider

    • Field Summary

      • Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

        context
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canWrite​(ch.qos.logback.classic.spi.ILoggingEvent event)
      Indicates if this provider can write anything for a particular event.
      java.lang.String getFieldName()  
      void setFieldName​(java.lang.String fieldName)  
      protected abstract void writeExactlyOneField​(JsonEventWriter writer, ch.qos.logback.classic.spi.ILoggingEvent event)
      Write exactly one field into JSON event layout.
      boolean writeTo​(JsonEventWriter writer, ch.qos.logback.classic.spi.ILoggingEvent event, boolean startWithSeparator)
      Writes a certain aspect of event into a writer.
      • Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase

        addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ch.qos.logback.core.spi.ContextAware

        addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
    • Constructor Detail

      • AbstractFieldJsonProvider

        public AbstractFieldJsonProvider()
    • Method Detail

      • canWrite

        public boolean canWrite​(ch.qos.logback.classic.spi.ILoggingEvent event)
        Description copied from interface: JsonProvider
        Indicates if this provider can write anything for a particular event. If this method returns false, writeTo() should not be called for a particular event. You can put all your preliminary checks here, no need to duplicated them in writeTo().
      • writeTo

        public boolean writeTo​(JsonEventWriter writer,
                               ch.qos.logback.classic.spi.ILoggingEvent event,
                               boolean startWithSeparator)
        Description copied from interface: JsonProvider
        Writes a certain aspect of event into a writer.
        Parameters:
        writer - JSON writer to use.
        event - Current logback event.
        startWithSeparator - If true, a separator should be written before writing anything else.
        Returns:
        If anything was effectively written during this call.
      • writeExactlyOneField

        protected abstract void writeExactlyOneField​(JsonEventWriter writer,
                                                     ch.qos.logback.classic.spi.ILoggingEvent event)
        Write exactly one field into JSON event layout.
        Parameters:
        writer - JSON writer to use.
        event - Current logback event.
      • getFieldName

        public java.lang.String getFieldName()
      • setFieldName

        public void setFieldName​(java.lang.String fieldName)