package org.apache.logging.log4j.core.filter;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.AbstractLifeCycle;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.message.Message;

public abstract class AbstractFilter extends AbstractLifeCycle implements Filter {
   protected final Filter.Result onMatch;
   protected final Filter.Result onMismatch;

   protected AbstractFilter() {
      this((Filter.Result)null, (Filter.Result)null);
   }

   protected AbstractFilter(Filter.Result onMatch, Filter.Result onMismatch) {
      this.onMatch = onMatch == null ? Filter.Result.NEUTRAL : onMatch;
      this.onMismatch = onMismatch == null ? Filter.Result.DENY : onMismatch;
   }

   public final Filter.Result getOnMismatch() {
      return this.onMismatch;
   }

   public final Filter.Result getOnMatch() {
      return this.onMatch;
   }

   public String toString() {
      return this.getClass().getSimpleName();
   }

   public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) {
      return Filter.Result.NEUTRAL;
   }

   public Filter.Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) {
      return Filter.Result.NEUTRAL;
   }

   public Filter.Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) {
      return Filter.Result.NEUTRAL;
   }

   public Filter.Result filter(LogEvent event) {
      return Filter.Result.NEUTRAL;
   }
}
