Logging to file directly. Win32 Services can't write to std::cout

This commit is contained in:
chertov 2014-04-23 02:10:21 +04:00
parent e3ff849aa4
commit 0236879c26
2 changed files with 14 additions and 5 deletions

12
Log.cpp
View file

@ -1,3 +1,15 @@
#include "Log.h"
#include "Daemon.h"
i2p::util::MsgQueue<LogMsg> g_Log;
void LogMsg::Process()
{
if (Daemon.isLogging == 1 && Daemon.logfile.is_open())
{
Daemon.logfile << s.str();
Daemon.logfile.flush();
}
output << s.str();
}

5
Log.h
View file

@ -12,10 +12,7 @@ struct LogMsg
LogMsg (std::ostream& o = std::cout): output (o) {};
void Process ()
{
output << s.str ();
}
void Process();
};
extern i2p::util::MsgQueue<LogMsg> g_Log;