[logback-dev] svn commit: r841 - in logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic: . spi turbo
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Tue Oct 31 22:49:48 CET 2006
Author: ceki
Date: Tue Oct 31 22:49:48 2006
New Revision: 841
Added:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
- copied, changed from r831, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ClassicFilter.java
Removed:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ClassicFilter.java
Modified:
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachable.java
logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachableImpl.java
Log:
renamed ClassicFilter as TurboFilter
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java Tue Oct 31 22:49:48 2006
@@ -16,7 +16,7 @@
import org.slf4j.ILoggerFactory;
import org.slf4j.Marker;
-import ch.qos.logback.classic.turbo.ClassicFilter;
+import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.classic.spi.ClassicFilterAttachable;
import ch.qos.logback.classic.spi.ClassicFilterAttachableImpl;
import ch.qos.logback.classic.spi.LoggerContextRemoteView;
@@ -169,7 +169,7 @@
}
- public void addFilter(ClassicFilter newFilter) {
+ public void addFilter(TurboFilter newFilter) {
if (cfai == null) {
cfai = new ClassicFilterAttachableImpl();
}
@@ -194,7 +194,7 @@
.getFilterChainDecision(marker, logger, level, format, params, t);
}
- public ClassicFilter getFirstFilter() {
+ public TurboFilter getFirstFilter() {
if (cfai == null) {
return null;
}
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachable.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachable.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachable.java Tue Oct 31 22:49:48 2006
@@ -4,7 +4,7 @@
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.turbo.ClassicFilter;
+import ch.qos.logback.classic.turbo.TurboFilter;
/**
* Interface for attaching ClassicFilter instances to objects.
@@ -16,12 +16,12 @@
/**
* Add a filter.
*/
- public void addFilter(ClassicFilter newFilter);
+ public void addFilter(TurboFilter newFilter);
/**
* Get first filter in the chain.
*/
- public ClassicFilter getFirstFilter();
+ public TurboFilter getFirstFilter();
public void clearAllFilters();
Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachableImpl.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachableImpl.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassicFilterAttachableImpl.java Tue Oct 31 22:49:48 2006
@@ -13,7 +13,7 @@
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.turbo.ClassicFilter;
+import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.core.filter.Filter;
/**
@@ -23,13 +23,13 @@
*/
final public class ClassicFilterAttachableImpl implements ClassicFilterAttachable {
- ClassicFilter headFilter;
- ClassicFilter tailFilter;
+ TurboFilter headFilter;
+ TurboFilter tailFilter;
/**
* Add a filter to end of the filter list.
*/
- public void addFilter(ClassicFilter newFilter) {
+ public void addFilter(TurboFilter newFilter) {
if (headFilter == null) {
headFilter = newFilter;
tailFilter = newFilter;
@@ -42,7 +42,7 @@
/**
* Get first filter in the chain.
*/
- public ClassicFilter getFirstFilter() {
+ public TurboFilter getFirstFilter() {
return headFilter;
}
@@ -50,9 +50,9 @@
* Clear the filter chain
*/
public void clearAllFilters() {
- ClassicFilter f = headFilter;
+ TurboFilter f = headFilter;
while (f != null) {
- final ClassicFilter next = f.getNext();
+ final TurboFilter next = f.getNext();
f.setNext(null);
f = next;
}
@@ -68,7 +68,7 @@
*/
public final int getFilterChainDecision(final Marker marker, final Logger logger,
final Level level, final String format, final Object[] params, final Throwable t) {
- ClassicFilter f = headFilter;
+ TurboFilter f = headFilter;
while (f != null) {
switch (f.decide(marker, logger, level, format, params, t)) {
Copied: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java (from r831, /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ClassicFilter.java)
==============================================================================
--- /logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ClassicFilter.java (original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java Tue Oct 31 22:49:48 2006
@@ -5,6 +5,8 @@
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.spi.LifeCycle;
/**
* ClassicFilter is a specialized filter with a decide method that takes a bunch of parameters
@@ -13,17 +15,20 @@
*
* @author Ceki Gulcu
*/
-public abstract class ClassicFilter extends Filter {
+public abstract class TurboFilter extends ContextAwareBase implements LifeCycle {
+ private String name;
+ boolean start = false;
+
/**
* Points to the next filter in the filter chain.
*/
- private ClassicFilter classicNext;
+ private TurboFilter classicNext;
/**
* Make a decision based on the multiple parameters passed as arguments.
- * The returned value should be one of <code>{@link #DENY}</code>,
- * <code>{@link #NEUTRAL}</code>, or <code>{@link #ACCEPT}</code>.
+ * The returned value should be one of <code>{@link Filter#DENY}</code>,
+ * <code>{@link Filter#NEUTRAL}</code>, or <code>{@link Filter#ACCEPT}</code>.
* @param marker
* @param logger
@@ -36,22 +41,39 @@
public abstract int decide(Marker marker, Logger logger,
Level level, String format, Object[] params, Throwable t);
- public int decide(Object o) {
- throw new UnsupportedOperationException("decide(Object) not supported");
+ public void start() {
+ this.start = true;
+ }
+
+ public boolean isStarted() {
+ return this.start;
}
+ public void stop() {
+ this.start = false;
+ }
+
+
/**
* Set the next filter pointer.
*/
- public void setNext(ClassicFilter next) {
+ public void setNext(TurboFilter next) {
this.classicNext = next;
}
/**
* Return the pointer to the next filter;
*/
- public ClassicFilter getNext() {
+ public TurboFilter getNext() {
return classicNext;
}
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
}
More information about the logback-dev
mailing list