<commit_before>package org.validcool;

import java.util.function.Consumer;

/**
 * Central point of validation for validcool.
 * @author amp
 * @since 1.0
 */
public class ValidcoolConfiguration {

    private boolean logErrorMessages;
    private Consumer<String> errorLogger;
    private Consumer<String> errorHandler;

    ValidcoolConfiguration() {
        logErrorMessages = false;
        errorLogger = System.err::println;
        errorHandler = (String message) -> {
            throw new ValidationException(message);
        };
    }

    /**
     * When a validation fails, it will be logged.
     */
    public void startLogging() {
        this.logErrorMessages = true;
    }

    /**
     * Stops to logIfEnabled error messages when validations fail.
     */
    public void stopLogging() {
        this.logErrorMessages = false;
    }

    /**
     * Whether error messages are logged when validations fail.
     */
    public boolean isLogging() {
        return this.logErrorMessages;
    }

    /**
     * Tells validcool how to logIfEnabled error messages, when validations fail.
     * By default all error messages are redirected to System.err.
     */
    public void setErrorLogger(Consumer<String> errorLogger) {
        this.errorLogger = errorLogger;
    }

    /**
     * Logs the specified error message iff logging is enabled (by calling startLogging).
     */
    void logIfEnabled(String errorMessage) {
        if(logErrorMessages) {
            errorLogger.accept(errorMessage);
        }
    }

    /**
     * Tells validcool how to handle failed validations.
     * By default an org.validcool.ValidationException is thrown.
     */
    public void setErrorHandler(Consumer<String> errorHandler) {
        if(errorHandler == null) {
            throw new IllegalArgumentException("tried to set validcool error handling function to null", new NullPointerException());
        }
        this.errorHandler = errorHandler;
    }

    /**
     * Handles validation error as specified in the configuration class.
     */
    public void handle(String errorMessage) {
        logIfEnabled(errorMessage);
        this.errorHandler.accept(errorMessage);
    }

}
<commit_msg>Update ValidcoolConfiguration.java<commit_after>package org.validcool;

import java.util.function.Consumer;

/**
 * Central point of configuration for validcool.
 * @author amp
 * @since 1.0
 */
public class ValidcoolConfiguration {

    private boolean logErrorMessages;
    private Consumer<String> errorLogger;
    private Consumer<String> errorHandler;

    ValidcoolConfiguration() {
        logErrorMessages = false;
        errorLogger = System.err::println;
        errorHandler = (String message) -> {
            throw new ValidationException(message);
        };
    }

    /**
     * When a validation fails, it will be logged.
     */
    public void startLogging() {
        this.logErrorMessages = true;
    }

    /**
     * Stops to logIfEnabled error messages when validations fail.
     */
    public void stopLogging() {
        this.logErrorMessages = false;
    }

    /**
     * Whether error messages are logged when validations fail.
     */
    public boolean isLogging() {
        return this.logErrorMessages;
    }

    /**
     * Tells validcool how to logIfEnabled error messages, when validations fail.
     * By default all error messages are redirected to System.err.
     */
    public void setErrorLogger(Consumer<String> errorLogger) {
        this.errorLogger = errorLogger;
    }

    /**
     * Logs the specified error message iff logging is enabled (by calling startLogging).
     */
    void logIfEnabled(String errorMessage) {
        if(logErrorMessages) {
            errorLogger.accept(errorMessage);
        }
    }

    /**
     * Tells validcool how to handle failed validations.
     * By default an org.validcool.ValidationException is thrown.
     */
    public void setErrorHandler(Consumer<String> errorHandler) {
        if(errorHandler == null) {
            throw new IllegalArgumentException("tried to set validcool error handling function to null", new NullPointerException());
        }
        this.errorHandler = errorHandler;
    }

    /**
     * Handles validation error as specified in the configuration class.
     */
    public void handle(String errorMessage) {
        logIfEnabled(errorMessage);
        this.errorHandler.accept(errorMessage);
    }

}

{'fraction_non_alphanumeric': 0.08517849073655671, 'fraction_numerical': 0.0009037505648441031, 'mean_word_length': 2.516282764098491, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3311322', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1123, 'n_words': 335}