Skip to content
Snippets Groups Projects
Commit f18227f4 authored by Steven Murray's avatar Steven Murray
Browse files

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

parent 5cd91c64
Branches
Tags
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment