diff --git a/src/common/Logger.cxx b/src/common/Logger.cxx index 8ec1b13cf..faace13c2 100644 --- a/src/common/Logger.cxx +++ b/src/common/Logger.cxx @@ -51,6 +51,8 @@ void Logger::debug(const string& message) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Logger::logMessage(const string& message, Level level) { + std::lock_guard lock(mutex); + if(level == Logger::Level::ERR) { cout << message << endl << std::flush; diff --git a/src/common/Logger.hxx b/src/common/Logger.hxx index f0baab5b2..bea486f94 100644 --- a/src/common/Logger.hxx +++ b/src/common/Logger.hxx @@ -19,6 +19,7 @@ #define LOGGER_HXX #include +#include #include "bspf.hxx" @@ -62,6 +63,8 @@ class Logger { // The list of log messages string myLogMessages; + std::mutex mutex; + private: void logMessage(const string& message, Level level);