StreamLogger#BindStream(): set #m_FlushLogTimer only if needed

refs #6737
This commit is contained in:
Alexander A. Klimov 2019-04-18 12:23:50 +02:00 committed by Michael Friedrich
parent ccbe9f7fbe
commit 622f684124

View File

@ -55,11 +55,13 @@ void StreamLogger::BindStream(std::ostream *stream, bool ownsStream)
m_Stream = stream; m_Stream = stream;
m_OwnsStream = ownsStream; m_OwnsStream = ownsStream;
if (!m_FlushLogTimer) {
m_FlushLogTimer = new Timer(); m_FlushLogTimer = new Timer();
m_FlushLogTimer->SetInterval(1); m_FlushLogTimer->SetInterval(1);
m_FlushLogTimer->OnTimerExpired.connect(std::bind(&StreamLogger::FlushLogTimerHandler, this)); m_FlushLogTimer->OnTimerExpired.connect(std::bind(&StreamLogger::FlushLogTimerHandler, this));
m_FlushLogTimer->Start(); m_FlushLogTimer->Start();
} }
}
/** /**
* Processes a log entry and outputs it to a stream. * Processes a log entry and outputs it to a stream.