Commit 315f742b authored by Steven Murray's avatar Steven Murray
Browse files

Added cta::log::Logger::setLogMask()

parent 90243332
......@@ -17,6 +17,7 @@
*/
#include "common/log/Logger.hpp"
#include "common/log/LogLevel.hpp"
#include "common/utils/utils.hpp"
#include "common/exception/Exception.hpp"
#include <sys/time.h>
......@@ -307,5 +308,23 @@ std::map<std::string, int>
return m;
}
//------------------------------------------------------------------------------
// setLogMask
//------------------------------------------------------------------------------
void Logger::setLogMask(const std::string logMask) {
try {
setLogMask(toLogLevel(logMask));
} catch(exception::Exception &ex) {
throw exception::Exception(std::string("Failed to set log mask: ") + ex.getMessage().str());
}
}
//------------------------------------------------------------------------------
// setLogMask
//------------------------------------------------------------------------------
void Logger::setLogMask(const int logMask) {
m_logMask = logMask;
}
} // namespace log
} // namespace cta
\ No newline at end of file
} // namespace cta
......@@ -21,6 +21,7 @@
#include "common/log/Constants.hpp"
#include "common/log/Param.hpp"
#include <atomic>
#include <list>
#include <map>
......@@ -123,6 +124,20 @@ public:
const int priority,
const std::string &msg,
const std::list<Param> &params = std::list<Param>());
/**
* Sets the log mask.
*
* @param logMask The log mask.
*/
void setLogMask(const std::string logMask);
/**
* Sets the log mask.
*
* @param logMask The log mask.
*/
void setLogMask(const int logMask);
/**
* Writes the header of a syslog message to teh specifed output stream.
......@@ -171,7 +186,7 @@ protected:
/**
* The log mask.
*/
int m_logMask;
std::atomic<int> m_logMask;
/**
* The maximum message length that the client syslog server can handle.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment