<commit_before>#include <iostream>
#include <ctime>

#include "logger.hpp"

std::ofstream Logger::file;

void Logger::init(std::string file_path) {
	if (file_path == "")
		file_path = "cr.log"; // Default value
	file.open(file_path);
}

void Logger::log(std::string message) {
	std::time_t time = std::time(nullptr);
	char timestr[9];
	if (std::strftime(timestr, sizeof(timestr), "%H:%M:%S", std::localtime(&time)))
		std::cout << "[" << timestr << "] ";

	std::cout << message << '\n';

	if (file.is_open())
		file << message << '\n';
}
<commit_msg>log time on file, append when using file<commit_after>#include <iostream>
#include <ctime>

#include "logger.hpp"

std::ofstream Logger::file;

void Logger::init(std::string file_path) {
	if (file_path == "")
		file_path = "cr.log"; // Default value
	file.open(file_path, std::ios::out | std::ios::app);
}

void Logger::log(std::string message) {
	std::time_t time = std::time(nullptr);
	char timestr[9];

	std::string msg;
	if (std::strftime(timestr, sizeof(timestr), "%H:%M:%S", std::localtime(&time))) {
		msg += "[";
		msg += timestr;
		msg += "] ";
	}
	msg += message;

	std::cout << msg << '\n';

	if (file.is_open())
		file << msg << '\n';
}

{'fraction_non_alphanumeric': 0.22101751459549623, 'fraction_numerical': 0.0016680567139282735, 'mean_word_length': 4.9405940594059405, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 7, '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': '4461735', 'n_tokens_mistral': 468, 'n_tokens_neox': 462, 'n_words': 97}