2013-12-10 13:00:13 +00:00
|
|
|
#include "Log.h"
|
|
|
|
|
2014-04-23 16:49:02 +00:00
|
|
|
Log g_Log;
|
2014-04-22 22:10:21 +00:00
|
|
|
|
|
|
|
void LogMsg::Process()
|
|
|
|
{
|
|
|
|
output << s.str();
|
2014-04-24 15:10:46 +00:00
|
|
|
|
|
|
|
std::cout << s.str (); // TODO: delete later
|
2014-04-23 16:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Log::Flush ()
|
|
|
|
{
|
2014-04-24 15:10:46 +00:00
|
|
|
if (m_LogFile)
|
|
|
|
m_LogFile->flush();
|
2014-04-23 16:49:02 +00:00
|
|
|
}
|
|
|
|
|
2014-04-24 15:10:46 +00:00
|
|
|
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);
|
|
|
|
if (m_LogFile->is_open ())
|
|
|
|
LogPrint("Logging to file ", fullFilePath, " enabled.");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete m_LogFile;
|
|
|
|
m_LogFile = nullptr;
|
|
|
|
}
|
|
|
|
}
|