mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
flush log only when queue is empty
This commit is contained in:
parent
42f228e75a
commit
58939de57e
3 changed files with 31 additions and 6 deletions
14
Log.h
14
Log.h
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue