aboutsummaryrefslogtreecommitdiffstats
path: root/src/Log.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-02-28 18:42:10 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-02-28 18:53:46 +0100
commit0818f2dec28732cd55071474c27732cc3196d772 (patch)
treee2acfdb538f21f54319ef0b0a01309babcaf9e51 /src/Log.cpp
parent3ab4c81e9cdcdc42118672fb0d38690db8f2478f (diff)
downloaddabmod-0818f2dec28732cd55071474c27732cc3196d772.tar.gz
dabmod-0818f2dec28732cd55071474c27732cc3196d772.tar.bz2
dabmod-0818f2dec28732cd55071474c27732cc3196d772.zip
Protect cerr by mutex in Log, and minor things
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 7db1d44..6bbc7a9 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -72,7 +72,10 @@ void Logger::logstr(log_level_t level, std::string message)
backend->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;
+ }
}