org.apache.rocketmq.shaded.ch.qos.logback.classic.filter.LevelFilter 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.classic.filter;
import org.apache.rocketmq.shaded.ch.qos.logback.classic.Level;
import org.apache.rocketmq.shaded.ch.qos.logback.classic.spi.ILoggingEvent;
import org.apache.rocketmq.shaded.ch.qos.logback.core.filter.AbstractMatcherFilter;
import org.apache.rocketmq.shaded.ch.qos.logback.core.spi.FilterReply;
/**
* A class that filters events by the level equality.
*
* For more information about this filter, please refer to the online manual at
* http://logback.qos.ch/manual/filters.html#levelFilter
*
* @author Ceki Gülcü
* @author Sébastien Pennec
*/
public class LevelFilter extends AbstractMatcherFilter {
Level level;
@Override
public FilterReply decide(ILoggingEvent event) {
if (!isStarted()) {
return FilterReply.NEUTRAL;
}
if (event.getLevel().equals(level)) {
return onMatch;
} else {
return onMismatch;
}
}
public void setLevel(Level level) {
this.level = level;
}
public void start() {
if (this.level != null) {
super.start();
}
}
}