mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
moved log file from daemon to log
This commit is contained in:
parent
3e81123d94
commit
2062305f88
4 changed files with 30 additions and 18 deletions
23
Log.cpp
23
Log.cpp
|
@ -1,20 +1,29 @@
|
|||
#include "Log.h"
|
||||
|
||||
#include "Daemon.h"
|
||||
|
||||
Log g_Log;
|
||||
|
||||
void LogMsg::Process()
|
||||
{
|
||||
if (Daemon.isLogging == 1 && Daemon.logfile.is_open())
|
||||
Daemon.logfile << s.str();
|
||||
|
||||
output << s.str();
|
||||
|
||||
std::cout << s.str (); // TODO: delete later
|
||||
}
|
||||
|
||||
void Log::Flush ()
|
||||
{
|
||||
if (Daemon.isLogging == 1 && Daemon.logfile.is_open())
|
||||
Daemon.logfile.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);
|
||||
if (m_LogFile->is_open ())
|
||||
LogPrint("Logging to file ", fullFilePath, " enabled.");
|
||||
else
|
||||
{
|
||||
delete m_LogFile;
|
||||
m_LogFile = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue