package com.eactive.eai.rms.common.interceptor.dynamicLog;

import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;

public class DynamicLogFilter extends Filter {
	private String key;

	public DynamicLogFilter(String key){
		this.key = key;
	}

	@Override
	public FilterReply decide(Object arg0) {
		String localKey = DynamicLogContext.getKey();
		if (localKey == null){
			return FilterReply.NEUTRAL;
		}else{
			if (localKey.equals(key)){
				return FilterReply.NEUTRAL;
			}else{
				return FilterReply.DENY;
			}
		}
	}

}
