org.apache.rocketmq.shaded.ch.qos.logback.core.filter.Filter Maven / Gradle / Ivy
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2015, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package org.apache.rocketmq.shaded.ch.qos.logback.core.filter;
import org.apache.rocketmq.shaded.ch.qos.logback.core.spi.ContextAwareBase;
import org.apache.rocketmq.shaded.ch.qos.logback.core.spi.FilterReply;
import org.apache.rocketmq.shaded.ch.qos.logback.core.spi.LifeCycle;
/**
* Users should extend this class to implement customized event filtering.
*
* We suggest that you first try to use the built-in rules before rushing to
* write your own custom filters.
*
*
For more information about filters, please refer to the online manual at
* http://logback.qos.ch/manual/filters.html
*
* @author Ceki Gülcü
*/
public abstract class Filter extends ContextAwareBase implements LifeCycle {
private String name;
boolean start = false;
public void start() {
this.start = true;
}
public boolean isStarted() {
return this.start;
}
public void stop() {
this.start = false;
}
/**
* If the decision is {@link FilterReply#DENY}
, then the event will be
* dropped. If the decision is {@link FilterReply#NEUTRAL}
, then the next
* filter, if any, will be invoked. If the decision is
* {@link FilterReply#ACCEPT}
then the event will be logged without
* consulting with other filters in the chain.
*
* @param event
* The event to decide upon.
*/
public abstract FilterReply decide(E event);
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}