public static boolean match()

in appender/utils/src/main/java/org/apache/karaf/decanter/appender/utils/EventFilter.java [30:60]


    public static boolean match(Event event, Dictionary<String, Object> config) {
        if (config == null) {
            return true;
        }

        String nameExcludeRegex = (config.get(PROPERTY_NAME_EXCLUDE_CONFIG) != null) ? (String) config.get(PROPERTY_NAME_EXCLUDE_CONFIG) : null;
        String nameIncludeRegex = (config.get(PROPERTY_NAME_INCLUDE_CONFIG) != null) ? (String) config.get(PROPERTY_NAME_INCLUDE_CONFIG) : null;
        String valueExcludeRegex = (config.get(PROPERTY_VALUE_EXCLUDE_CONFIG) != null) ? (String) config.get(PROPERTY_VALUE_EXCLUDE_CONFIG) : null;
        String valueIncludeRegex = (config.get(PROPERTY_VALUE_INCLUDE_CONFIG) != null) ? (String) config.get(PROPERTY_VALUE_INCLUDE_CONFIG) : null;

        for (String name : event.getPropertyNames()) {
            if (nameExcludeRegex != null && name.matches(nameExcludeRegex)) {
                return false;
            }

            if (nameIncludeRegex != null && name.matches(nameIncludeRegex)) {
                return true;
            }

            if (event.getProperty(name) != null && event.getProperty(name) instanceof String) {
                if (valueExcludeRegex != null && ((String) event.getProperty(name)).matches(valueExcludeRegex)) {
                    return false;
                }
                if (valueIncludeRegex != null && ((String) event.getProperty(name)).matches(valueIncludeRegex)) {
                    return true;
                }
            }

        }
        return true;
    }