<commit_before>package com.roche.sequencing.bioinformatics.common.utils;

import java.io.File;
import java.io.IOException;

import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.FileAppender;

public class LoggingUtil {

	private static File currentLogFile;

	private LoggingUtil() {
		throw new AssertionError();
	}

	public static void setLogFile(String loggerName, File logFile) throws IOException {
		if (!logFile.exists()) {
			FileUtil.createNewFile(logFile);
		}

		currentLogFile = logFile;

		LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();

		FileAppender<ILoggingEvent> fileAppender = new FileAppender<ILoggingEvent>();
		fileAppender.setContext(loggerContext);
		fileAppender.setName(logFile.getName());
		fileAppender.setFile(logFile.getAbsolutePath());

		PatternLayoutEncoder encoder = new PatternLayoutEncoder();
		encoder.setContext(loggerContext);
		encoder.setPattern("%r %d{HH:mm:ss.SSS} - %msg%n");
		encoder.setImmediateFlush(true);
		encoder.start();

		fileAppender.setEncoder(encoder);
		fileAppender.start();

		// attach the rolling file appender to the logger of your choice
		Logger logbackLogger = loggerContext.getLogger(loggerName);
		logbackLogger.setLevel(Level.ALL);
		logbackLogger.addAppender(fileAppender);
	}

	public static File getLogFile() {
		return currentLogFile;
	}

}<commit_msg>adding fxnality for verbose option to logging util<commit_after>package com.roche.sequencing.bioinformatics.common.utils;

import java.io.File;
import java.io.IOException;

import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.FileAppender;

public class LoggingUtil {

	private static File currentLogFile;

	private LoggingUtil() {
		throw new AssertionError();
	}

	public static void setLogFile(String loggerName, File logFile) throws IOException {
		if (!logFile.exists()) {
			FileUtil.createNewFile(logFile);
		}

		currentLogFile = logFile;

		LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();

		FileAppender<ILoggingEvent> fileAppender = new FileAppender<ILoggingEvent>();
		fileAppender.setContext(loggerContext);
		fileAppender.setName(logFile.getName());
		fileAppender.setFile(logFile.getAbsolutePath());

		PatternLayoutEncoder encoder = new PatternLayoutEncoder();
		encoder.setContext(loggerContext);
		encoder.setPattern("%r %d{HH:mm:ss.SSS} - %msg%n");
		encoder.setImmediateFlush(true);
		encoder.start();

		fileAppender.setEncoder(encoder);
		fileAppender.start();

		// attach the rolling file appender to the logger of your choice
		Logger logbackLogger = loggerContext.getLogger(loggerName);
		logbackLogger.setLevel(Level.ALL);
		logbackLogger.addAppender(fileAppender);
	}

	public static File getLogFile() {
		return currentLogFile;
	}

	public static void outputLogsToConsole(String loggerName) {
		LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();

		PatternLayoutEncoder encoder = new PatternLayoutEncoder();
		encoder.setContext(loggerContext);
		encoder.setPattern("%r %d{HH:mm:ss.SSS} - %msg%n");
		encoder.setImmediateFlush(true);
		encoder.start();

		ConsoleAppender<ILoggingEvent> logConsoleAppender = new ConsoleAppender<ILoggingEvent>();
		logConsoleAppender.setContext(loggerContext);
		logConsoleAppender.setName("console");
		logConsoleAppender.setEncoder(encoder);
		logConsoleAppender.start();

		Logger log = loggerContext.getLogger(loggerName);
		log.addAppender(logConsoleAppender);
	}

}
{'fraction_non_alphanumeric': 0.10806045340050378, 'fraction_numerical': 0.0005037783375314861, 'mean_word_length': 6.053285968028419, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5017610', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1233, 'n_words': 222}