Fixing a problem with log output in log window

This commit is contained in:
Matthias Koefferlein 2021-05-12 23:42:14 +02:00
parent 453ff7c7ad
commit f7631b2b2d
2 changed files with 6 additions and 8 deletions

View File

@ -41,7 +41,7 @@ namespace lay
// LogReceiver implementation // LogReceiver implementation
LogReceiver::LogReceiver (LogFile *file, int verbosity, void (LogFile::*method)(const std::string &, bool)) LogReceiver::LogReceiver (LogFile *file, int verbosity, void (LogFile::*method)(const std::string &, bool))
: mp_file (file), m_method (method), m_continued (false), m_verbosity (verbosity) : mp_file (file), m_method (method), m_verbosity (verbosity)
{ {
// .. nothing yet .. // .. nothing yet ..
} }
@ -64,7 +64,9 @@ LogReceiver::puts (const char *s)
} }
if (*s == '\n') { if (*s == '\n') {
endl (); QMutexLocker locker (&m_lock);
(mp_file->*m_method) (m_text, true);
m_text.clear ();
++s; ++s;
} }
@ -78,9 +80,8 @@ LogReceiver::endl ()
{ {
if (tl::verbosity () >= m_verbosity) { if (tl::verbosity () >= m_verbosity) {
QMutexLocker locker (&m_lock); QMutexLocker locker (&m_lock);
(mp_file->*m_method) (m_text, m_continued); (mp_file->*m_method) (m_text, false);
m_text.clear (); m_text.clear ();
m_continued = true;
} }
} }
@ -99,9 +100,7 @@ LogReceiver::end ()
void void
LogReceiver::begin () LogReceiver::begin ()
{ {
QMutexLocker locker (&m_lock); // .. nothing yet ..
m_continued = false;
m_text.clear ();
} }
// ----------------------------------------------------------------- // -----------------------------------------------------------------

View File

@ -96,7 +96,6 @@ private:
LogFile *mp_file; LogFile *mp_file;
void (LogFile::*m_method)(const std::string &, bool); void (LogFile::*m_method)(const std::string &, bool);
std::string m_text; std::string m_text;
bool m_continued;
int m_verbosity; int m_verbosity;
QMutex m_lock; QMutex m_lock;
}; };