ArmarXLog.cpp
Go to the documentation of this file.
1 #include "ArmarXLog.h"
2 
4 
5 namespace armarx::semantic
6 {
7 
8  void ArmarXLog::setAsImplementation(const std::string& tag)
9  {
10  semrel::LogInterface::setImplementation(std::make_shared<ArmarXLog>(tag));
11  }
12 
13  ArmarXLog::ArmarXLog(const std::string& tag)
14  {
15  setTag(tag);
17  }
18 
19 
20  void ArmarXLog::log(semrel::LogMetaInfo info, const std::string& message)
21  {
22  (*loghelper(info.file.c_str(), info.line, info.func.c_str()))
23  << logLevelToMessageType(info.level)
24  << message;
25  }
26 
27  armarx::MessageTypeT ArmarXLog::logLevelToMessageType(semrel::LogLevel level)
28  {
29  switch (level)
30  {
31  case semrel::LogLevel::DEBUG:
33  case semrel::LogLevel::VERBOSE:
35  case semrel::LogLevel::INFO:
37  case semrel::LogLevel::IMPORTANT:
39  case semrel::LogLevel::WARNING:
41  case semrel::LogLevel::ERROR:
43 
44  default:
45  ARMARX_UNEXPECTED_ENUM_VALUE(semrel::LogLevel, level);
46  }
47  }
48 
49 }
armarx::MessageTypeT::ERROR
@ ERROR
armarx::MessageTypeT
MessageTypeT
Definition: LogSender.h:45
ARMARX_UNEXPECTED_ENUM_VALUE
#define ARMARX_UNEXPECTED_ENUM_VALUE(EnumType, value)
Throw an UnexpectedEnumValueException.
Definition: UnexpectedEnumValueException.h:61
armarx::MessageTypeT::WARN
@ WARN
armarx::semantic::ArmarXLog::log
void log(semrel::LogMetaInfo info, const std::string &message) override
Definition: ArmarXLog.cpp:20
armarx::MessageTypeT::INFO
@ INFO
armarx::MessageTypeT::VERBOSE
@ VERBOSE
armarx::Logging::loghelper
LogSenderPtr loghelper(const char *file, int line, const char *function) const
Definition: Logging.cpp:102
armarx::MessageTypeT::IMPORTANT
@ IMPORTANT
armarx::semantic::ArmarXLog::setAsImplementation
static void setAsImplementation(const std::string &tag)
Definition: ArmarXLog.cpp:8
message
message(STATUS "Boost-Library-Dir: " "${Boost_LIBRARY_DIRS}") message(STATUS "Boost-LIBRARIES
Definition: CMakeLists.txt:8
UnexpectedEnumValueException.h
armarx::semantic::ArmarXLog::ArmarXLog
ArmarXLog(const std::string &tag="")
Definition: ArmarXLog.cpp:13
ArmarXLog.h
armarx::semantic
Definition: ShapesSupportRelations.cpp:32
armarx::LogSender::SetComponentName
static void SetComponentName(const std::string &componentName)
Definition: LogSender.cpp:155
armarx::MessageTypeT::DEBUG
@ DEBUG
armarx::Logging::tag
LogTag tag
Definition: Logging.h:271
armarx::Logging::setTag
void setTag(const LogTag &tag)
Definition: Logging.cpp:55