File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828#include < fstream>
2929#include < iostream>
3030#include < map>
31+ #include < mutex>
3132#include < stdexcept>
3233
3334#ifdef Q_OS_ANDROID
@@ -88,6 +89,8 @@ class Logger::Impl
8889 using StreamMap = std::map<Logger::Level, std::ostream *>;
8990 static StreamMap m_streams;
9091
92+ static std::mutex m_mutex;
93+
9194 Logger::Level m_activeLevel = Logger::Level::Info;
9295
9396 std::ostringstream m_oss;
@@ -121,13 +124,18 @@ Logger::Impl::StreamMap Logger::Impl::m_streams = {
121124 {Logger::Level::Fatal, &std::cerr}
122125};
123126
127+ std::mutex Logger::Impl::m_mutex;
128+
124129Logger::Impl::Impl ()
125130{
131+ Logger::Impl::m_mutex.lock ();
126132}
127133
128134Logger::Impl::~Impl ()
129135{
130136 flush ();
137+
138+ Logger::Impl::m_mutex.unlock ();
131139}
132140
133141void Logger::Impl::enableEchoMode (bool enable)
You can’t perform that action at this time.
0 commit comments