<commit_before>package org.lightmare.utils;

import org.apache.log4j.Logger;

/**
 * Utility class for logging
 * 
 * @author levan
 * @since 0.0.81-SNAPSHOT
 */
public class LogUtils {

    /**
     * Generates logging messages
     * 
     * @param message
     * @param formats
     * @return {@link String}
     */
    public static String logMessage(String message, Object... formats) {

	String logMessage;

	if (CollectionUtils.valid(formats)) {
	    logMessage = String.format(message, formats);
	} else {
	    logMessage = message;
	}

	return logMessage;
    }

    /**
     * Generated fatal log
     * 
     * @param log
     * @param ex
     * @param message
     * @param formats
     */
    public static void fatal(Logger log, Throwable ex, String message,
	    Object... formats) {

	String logMessage = logMessage(message, formats);

	if (ex == null) {
	    log.fatal(logMessage);
	} else {
	    log.fatal(logMessage, ex);
	}
    }

    /**
     * Generates fatal logs
     * 
     * @param log
     * @param message
     * @param formats
     */
    public static void fatal(Logger log, String message, Object... formats) {

	fatal(log, null, message, formats);
    }

    /**
     * Generates error log
     * 
     * @param log
     * @param ex
     * @param message
     * @param formats
     */
    public static void error(Logger log, Throwable ex, String message,
	    Object... formats) {

	String logMessage = logMessage(message, formats);

	if (ex == null) {
	    log.error(logMessage);
	} else {
	    log.error(logMessage, ex);
	}
    }

    /**
     * Generates error logs
     * 
     * @param log
     * @param message
     * @param formats
     */
    public static void error(Logger log, String message, Object... formats) {

	error(log, null, message, formats);
    }

    /**
     * Generates debug logs
     * 
     * @param log
     * @param ex
     * @param message
     * @param formats
     */
    public static void debug(Logger log, Throwable ex, String message,
	    Object... formats) {

	String logMessage = logMessage(message, formats);
	if (ex == null) {
	    log.debug(logMessage);
	} else {
	    log.debug(logMessage, ex);
	}
    }
<commit_msg>improved / commented code utiliti classes<commit_after>package org.lightmare.utils;

import org.apache.log4j.Logger;

/**
 * Utility class for logging
 * 
 * @author levan
 * @since 0.0.81-SNAPSHOT
 */
public class LogUtils {

    /**
     * Generates logging messages
     * 
     * @param message
     * @param formats
     * @return {@link String}
     */
    public static String logMessage(String message, Object... formats) {

	String logMessage;

	if (CollectionUtils.valid(formats)) {
	    logMessage = String.format(message, formats);
	} else {
	    logMessage = message;
	}

	return logMessage;
    }

    /**
     * Generated fatal log
     * 
     * @param log
     * @param ex
     * @param message
     * @param formats
     */
    public static void fatal(Logger log, Throwable ex, String message,
	    Object... formats) {

	String logMessage = logMessage(message, formats);

	if (ex == null) {
	    log.fatal(logMessage);
	} else {
	    log.fatal(logMessage, ex);
	}
    }

    /**
     * Generates fatal logs
     * 
     * @param log
     * @param message
     * @param formats
     */
    public static void fatal(Logger log, String message, Object... formats) {

	fatal(log, null, message, formats);
    }

    /**
     * Generates error log
     * 
     * @param log
     * @param ex
     * @param message
     * @param formats
     */
    public static void error(Logger log, Throwable ex, String message,
	    Object... formats) {

	String logMessage = logMessage(message, formats);

	if (ex == null) {
	    log.error(logMessage);
	} else {
	    log.error(logMessage, ex);
	}
    }

    /**
     * Generates error logs
     * 
     * @param log
     * @param message
     * @param formats
     */
    public static void error(Logger log, String message, Object... formats) {

	error(log, null, message, formats);
    }

    /**
     * Generates debug logs
     * 
     * @param log
     * @param ex
     * @param message
     * @param formats
     */
    public static void debug(Logger log, Throwable ex, String message,
	    Object... formats) {

	String logMessage = logMessage(message, formats);

	if (ex == null) {
	    log.debug(logMessage);
	} else {
	    log.debug(logMessage, ex);
	}
    }

{'fraction_non_alphanumeric': 0.12021734208738963, 'fraction_numerical': 0.0022639800769753225, 'mean_word_length': 2.164756446991404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1683786', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1333, 'n_words': 378}