- fix extra \r\n in logs

This commit is contained in:
Dmytro Bogovych 2022-06-18 13:03:30 +03:00
parent fa705e141b
commit 9d79c01be0
2 changed files with 9 additions and 4 deletions

View File

@ -201,7 +201,6 @@ void Logger::beginLine(LogLevel level, const char* filename, int linenumber, con
void void
Logger::endLine() Logger::endLine()
{ {
*mStream << std::endl;
*mStream << std::flush; *mStream << std::flush;
mStream->flush(); mStream->flush();
@ -213,7 +212,7 @@ Logger::endLine()
result << time_buffer << ":" << (unix_timestamp_ms.count() % 1000 ) << "\t" << " | " << std::setw(8) << ThreadInfo::currentThread() << " | " << std::setw(30) result << time_buffer << ":" << (unix_timestamp_ms.count() % 1000 ) << "\t" << " | " << std::setw(8) << ThreadInfo::currentThread() << " | " << std::setw(30)
<< mFilename.c_str() << " | " << std::setw(4) << mLine << " | " << std::setw(12) << mSubsystem.c_str() << " | " << mFilename.c_str() << " | " << std::setw(4) << mLine << " | " << std::setw(12) << mSubsystem.c_str() << " | "
<< mStream->str().c_str(); << mStream->str().c_str() << std::endl;
std::string t = result.str(); std::string t = result.str();
if (mUseDebugWindow) { if (mUseDebugWindow) {

View File

@ -86,8 +86,14 @@ protected:
class LogLock class LogLock
{ {
public: public:
LogLock(LogGuard& g) :mGuard(g) { mGuard.Lock(); } LogLock(LogGuard& g) :mGuard(g)
~LogLock() { mGuard.Unlock(); } {
mGuard.Lock();
}
~LogLock()
{
mGuard.Unlock();
}
protected: protected:
LogGuard& mGuard; LogGuard& mGuard;