flush log only when queue is empty

This commit is contained in:
orignal 2014-04-23 12:49:02 -04:00
parent 42f228e75a
commit 58939de57e
3 changed files with 31 additions and 6 deletions

14
Log.h
View file

@ -3,6 +3,7 @@
#include <iostream>
#include <sstream>
#include <functional>
#include "Queue.h"
struct LogMsg
@ -15,7 +16,18 @@ struct LogMsg
void Process();
};
extern i2p::util::MsgQueue<LogMsg> g_Log;
class Log: public i2p::util::MsgQueue<LogMsg>
{
public:
Log () { SetOnEmpty (std::bind (&Log::Flush, this)); };
private:
void Flush ();
};
extern Log g_Log;
template<typename TValue>
void LogPrint (std::stringstream& s, TValue arg)