summaryrefslogtreecommitdiffstats
path: root/src/Log.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-02-28 18:04:18 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-02-28 18:04:18 +0100
commit1a258711b00cef322cadedf35540d64ae18eb0b0 (patch)
treeb779f6b92bd7b87e032ed9b31d787f0bd59aff1d /src/Log.cpp
parentfe086519ac999051d28b2d73222626c15682ce31 (diff)
downloaddabmux-1a258711b00cef322cadedf35540d64ae18eb0b0.tar.gz
dabmux-1a258711b00cef322cadedf35540d64ae18eb0b0.tar.bz2
dabmux-1a258711b00cef322cadedf35540d64ae18eb0b0.zip
Guard log print to stderr with mutex
Diffstat (limited to 'src/Log.cpp')
-rw-r--r--src/Log.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Log.cpp b/src/Log.cpp
index f8f7d7f..90548af 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -74,7 +74,10 @@ void Logger::logstr(log_level_t level, std::string message)
(*it)->log(level, message);
}
- std::cerr << levels_as_str[level] << " " << message << std::endl;
+ {
+ std::lock_guard<std::mutex> guard(m_cerr_mutex);
+ std::cerr << levels_as_str[level] << " " << message << std::endl;
+ }
}