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()  
      boolean isEnabled()
      Indicates if this provider is enabled.
      boolean isStarted()  
      void setEnabled​(boolean enabled)
      Allows to configure if the provider is enabled.
      void setFieldName​(java.lang.String fieldName)  
      void start()  
      void stop()  
      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().
        Specified by:
        canWrite in interface JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent>
      • 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.
        Specified by:
        writeTo in interface JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent>
        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.
      • start

        public void start()
        Specified by:
        start in interface ch.qos.logback.core.spi.LifeCycle
      • stop

        public void stop()
        Specified by:
        stop in interface ch.qos.logback.core.spi.LifeCycle
      • isStarted

        public boolean isStarted()
        Specified by:
        isStarted in interface ch.qos.logback.core.spi.LifeCycle
      • isEnabled

        public boolean isEnabled()
        Description copied from interface: JsonProvider
        Indicates if this provider is enabled. For a disabled provider no other its methods should be called.
        Specified by:
        isEnabled in interface JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent>
      • setEnabled

        public void setEnabled​(boolean enabled)
        Description copied from interface: JsonProvider
        Allows to configure if the provider is enabled.
        Specified by:
        setEnabled in interface JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent>
      • getFieldName

        public java.lang.String getFieldName()
      • setFieldName

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