60 #ifndef LOGGER_LOGGER_HPP
61 #define LOGGER_LOGGER_HPP
76 #ifndef PROJECT_SOURCE_DIR
77 #define PROJECT_SOURCE_DIR ""
101 const std::string &arg =
"");
108 const std::string& message,
109 const std::string& file,
110 const unsigned int line,
111 const std::string& func,
112 const std::string& rootDir);
123 #define LOG(SEVERITY, MESSAGE) \
126 if (logger::Logger::getLogLevel() <= logger::LogLevel::SEVERITY) { \
127 std::ostringstream messageStream__; \
128 messageStream__ << MESSAGE; \
129 logger::Logger::logMessage(logger::LogLevel::SEVERITY, \
130 messageStream__.str(), \
134 PROJECT_SOURCE_DIR); \
140 #define LOGE(MESSAGE) LOG(ERROR, MESSAGE)
143 #define LOGW(MESSAGE) LOG(WARN, MESSAGE)
146 #define LOGI(MESSAGE) LOG(INFO, MESSAGE)
149 #define LOGD(MESSAGE) LOG(DEBUG, MESSAGE)
153 #define LOGH(MESSAGE) LOG(HELP, MESSAGE)
156 #define LOGT(MESSAGE) LOG(TRACE, MESSAGE)
158 #define LOGD(MESSAGE) do {} while (0)
159 #define LOGH(MESSAGE) do {} while (0)
160 #define LOGT(MESSAGE) do {} while (0)
163 #endif // LOGGER_LOGGER_HPP
static LogLevel getLogLevel(void)
Definition: logger.cpp:103
static void logMessage(LogLevel logLevel, const std::string &message, const std::string &file, const unsigned int line, const std::string &func, const std::string &rootDir)
Definition: logger.cpp:81
static void setLogBackend(LogBackend *pBackend)
Definition: logger.cpp:108
Persistent file backend for logger.
LogLevel
Available log levels.
Definition: level.hpp:36
void setupLogger(const LogType type, const LogLevel level, const std::string &arg)
A helper function to easily and completely setup a new logger.
Definition: logger.cpp:43
Definition: logger.hpp:105
LogType
Definition: logger.hpp:82
Stderr backend for logger.
Abstract class for logger backends.
Definition: backend.hpp:38
Syslog backend for logger.
static void setLogLevel(const LogLevel level)
Definition: logger.cpp:93
Systemd journal backend for logger.