<commit_before>#include "Log.h"
#include <boost/date_time/posix_time/posix_time.hpp>

Log * g_Log = nullptr;

static const char * g_LogLevelStr[eNumLogLevels] =
{
	"error", // eLogError
	"warn",  // eLogWarning
	"info",  // eLogInfo
	"debug"	 // eLogDebug 
};

void LogMsg::Process()
{
	output << boost::posix_time::second_clock::local_time().time_of_day () <<  
		"/" << g_LogLevelStr[level] << " - ";
	output << s.str();
}

void Log::Flush ()
{
	if (m_LogFile)
		m_LogFile->flush();
}

void Log::SetLogFile (const std::string& fullFilePath)
{
	if (m_LogFile) delete m_LogFile;
	m_LogFile = new std::ofstream (fullFilePath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc);<commit_msg>fixed crash for Windows<commit_after>#include "Log.h"
#include <boost/date_time/posix_time/posix_time.hpp>

Log * g_Log = nullptr;

static const char * g_LogLevelStr[eNumLogLevels] =
{
	"error", // eLogError
	"warn",  // eLogWarning
	"info",  // eLogInfo
	"debug"	 // eLogDebug 
};

void LogMsg::Process()
{
	output << boost::posix_time::second_clock::local_time().time_of_day () <<  
		"/" << g_LogLevelStr[level] << " - ";
	output << s.str();
}

void Log::Flush ()
{
#ifdef _WIN32	
	if (m_LogFile)
		m_LogFile->flush();
#endif
// TODO: find out what's wrong with flush for Windows	
}

void Log::SetLogFile (const std::string& fullFilePath)
{
	if (m_LogFile) delete m_LogFile;
	m_LogFile = new std::ofstream (fullFilePath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc);
{'fraction_non_alphanumeric': 0.17525083612040135, 'fraction_numerical': 0.0013377926421404682, 'mean_word_length': 4.866666666666666, 'pattern_counts': {'":': 0, '<': 25, '<?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': '4562156', 'n_tokens_mistral': 588, 'n_tokens_neox': 577, 'n_words': 108}