Package dk.gtz.graphedit.logging
Class EditorLogAppender
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
dk.gtz.graphedit.logging.EditorLogAppender
- All Implemented Interfaces:
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>
,ch.qos.logback.core.spi.ContextAware
,ch.qos.logback.core.spi.FilterAttachable<ch.qos.logback.classic.spi.ILoggingEvent>
,ch.qos.logback.core.spi.LifeCycle
public class EditorLogAppender
extends ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
A pub-sub pattern class that takes logback logging events and informs all subscribed consumers
-
Field Summary
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
append
(ch.qos.logback.classic.spi.ILoggingEvent eventObject) void
doAppend
(ch.qos.logback.classic.spi.ILoggingEvent eventObject) static UUID
Add a logconsume function to the list of consumersstatic void
unsubscribe
(UUID key) Will remove the logconsume function with the associated key.Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, start, stop, toString
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, wait, wait, wait
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
EditorLogAppender
public EditorLogAppender()Constructs a new EditorLogAppender instance
-
-
Method Details
-
append
protected void append(ch.qos.logback.classic.spi.ILoggingEvent eventObject) - Specified by:
append
in classch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
doAppend
public void doAppend(ch.qos.logback.classic.spi.ILoggingEvent eventObject) - Specified by:
doAppend
in interfacech.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>
- Overrides:
doAppend
in classch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
-
subscribe
public static UUID subscribe(ch.qos.logback.classic.Level levelFilter, Consumer<String> logConsumer) Add a logconsume function to the list of consumers- Parameters:
levelFilter
- the log level at which the logconsumer function will be invokedlogConsumer
- the logconsumer function to invoke- Returns:
- the registered key. Use this to unsubscribe again later if needed
-
unsubscribe
Will remove the logconsume function with the associated key.- Parameters:
key
- the identifying key of the logconsumer to remove
-