30 #ifndef __TERRALIB_CORE_LOGGER_LOGGER_H__ 31 #define __TERRALIB_CORE_LOGGER_LOGGER_H__ 35 #include "../Config.h" 36 #include "../utils/Platform.h" 39 #include <boost/log/attributes/attribute_set.hpp> 41 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS 42 #define CURRENT_FUNCTION std::string(__FUNCTION__) 44 #define CURRENT_FUNCTION std::string(__PRETTY_FUNCTION__) 94 void log(
const std::string& message,
const std::string &channel, severity_level severity);
103 void addLoggerFromFile(
const std::string &filename);
117 void addLogger(
const std::string &name,
const std::string &filename, std::string format);
126 bool exists(
const std::string &name);
131 void removeAllLoggers();
153 std::pair< boost::log::attribute_set::iterator, bool >
m_process;
154 std::pair< boost::log::attribute_set::iterator, bool >
m_processId;
155 std::pair< boost::log::attribute_set::iterator, bool >
m_threadId;
170 #ifdef TERRALIB_LOGGER_ENABLED 171 #define TE_ADD_LOGGER(name, filename, format) te::core::Logger::instance().addLogger(name, filename, format) 173 #define TE_ADD_LOGGER(name, filename, format) ((void)0) 186 #ifdef TERRALIB_LOGGER_ENABLED 187 #define TE_ADD_LOGGER_FROM_FILE(filename) te::core::Logger::instance().addLoggerFromFile(filename) 189 #define TE_ADD_LOGGER_FROM_FILE(filename) ((void)0) 199 #ifdef TERRALIB_LOGGER_ENABLED 200 #define TE_INIT_DEFAULT_LOGGER(filename) te::core::Logger::instance().addLogger(TERRALIB_DEFAULT_LOGGER, filename, TERRALIB_DEFAULT_LOGGER_FORMAT) 202 #define TE_INIT_DEFAULT_LOGGER(filename) ((void)0) 213 #ifdef TERRALIB_LOGGER_TRACE_ENABLED 214 #define TE_CORE_LOG_TRACE(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::trace) 216 #define TE_CORE_LOG_TRACE(channel, message) ((void)0) 227 #ifdef TERRALIB_LOGGER_DEBUG_ENABLED 228 #define TE_CORE_LOG_DEBUG(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::debug) 230 #define TE_CORE_LOG_DEBUG(channel, message) ((void)0) 241 #ifdef TERRALIB_LOGGER_INFO_ENABLED 242 #define TE_CORE_LOG_INFO(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::info) 244 #define TE_CORE_LOG_INFO(channel, message) ((void)0) 255 #ifdef TERRALIB_LOGGER_WARN_ENABLED 256 #define TE_CORE_LOG_WARN(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::warning) 258 #define TE_CORE_LOG_WARN(channel, message) ((void)0) 269 #ifdef TERRALIB_LOGGER_ERROR_ENABLED 270 #define TE_CORE_LOG_ERROR(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::error) 272 #define TE_CORE_LOG_ERROR(channel, message) ((void)0) 283 #ifdef TERRALIB_LOGGER_FATAL_ENABLED 284 #define TE_CORE_LOG_FATAL(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::fatal) 286 #define TE_CORE_LOG_FATAL(channel, message) ((void)0) 298 #define TE_LOG_TRACE(message) TE_CORE_LOG_TRACE(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 309 #define TE_LOG_DEBUG(message) TE_CORE_LOG_DEBUG(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 320 #define TE_LOG_INFO(message) TE_CORE_LOG_INFO(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 331 #define TE_LOG_WARN(message)TE_CORE_LOG_WARN(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 342 #define TE_LOG_ERROR(message) TE_CORE_LOG_ERROR(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 353 #define TE_LOG_FATAL(message) TE_CORE_LOG_FATAL(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 355 #endif // __TERRALIB_CORE_LOGGER_LOGGER_H__
const std::string TERRALIB_DEFAULT_LOGGER
The default name of the log file if none is informed.
const std::string TERRALIB_DEFAULT_LOGGER_FORMAT
The default message format if none is informed.
std::pair< boost::log::attribute_set::iterator, bool > m_processId
std::pair< boost::log::attribute_set::iterator, bool > m_process
std::pair< boost::log::attribute_set::iterator, bool > m_threadId