30 #ifndef __TERRALIB_CORE_LOGGER_LOGGER_H__
31 #define __TERRALIB_CORE_LOGGER_LOGGER_H__
35 #include "../Config.h"
36 #include "../utils/Platform.h"
37 #include "../../BuildConfig.h"
39 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS
40 #define CURRENT_FUNCTION std::string(__FUNCTION__)
42 #define CURRENT_FUNCTION std::string(__PRETTY_FUNCTION__)
92 void log(
const std::string& message,
const std::string &channel, severity_level severity);
101 void addLoggerFromFile(
const std::string &filename);
115 void addLogger(
const std::string &name,
const std::string &filename, std::string format);
124 bool exists(
const std::string &name);
129 void removeAllLoggers();
166 #ifdef TERRALIB_LOGGER_ENABLED
167 #define TE_ADD_LOGGER(name, filename, format) te::core::Logger::instance().addLogger(name, filename, format)
169 #define TE_ADD_LOGGER(name, filename, format) ((void)0)
182 #ifdef TERRALIB_LOGGER_ENABLED
183 #define TE_ADD_LOGGER_FROM_FILE(filename) te::core::Logger::instance().addLoggerFromFile(filename)
185 #define TE_ADD_LOGGER_FROM_FILE(filename) ((void)0)
195 #ifdef TERRALIB_LOGGER_ENABLED
196 #define TE_INIT_DEFAULT_LOGGER(filename) te::core::Logger::instance().addLogger(TERRALIB_DEFAULT_LOGGER, filename, TERRALIB_DEFAULT_LOGGER_FORMAT)
198 #define TE_INIT_DEFAULT_LOGGER(filename) ((void)0)
209 #ifdef TERRALIB_LOGGER_TRACE_ENABLED
210 #define TE_CORE_LOG_TRACE(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::trace)
212 #define TE_CORE_LOG_TRACE(channel, message) ((void)0)
223 #ifdef TERRALIB_LOGGER_DEBUG_ENABLED
224 #define TE_CORE_LOG_DEBUG(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::debug)
226 #define TE_CORE_LOG_DEBUG(channel, message) ((void)0)
237 #ifdef TERRALIB_LOGGER_INFO_ENABLED
238 #define TE_CORE_LOG_INFO(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::info)
240 #define TE_CORE_LOG_INFO(channel, message) ((void)0)
251 #ifdef TERRALIB_LOGGER_WARN_ENABLED
252 #define TE_CORE_LOG_WARN(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::warning)
254 #define TE_CORE_LOG_WARN(channel, message) ((void)0)
265 #ifdef TERRALIB_LOGGER_ERROR_ENABLED
266 #define TE_CORE_LOG_ERROR(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::error)
268 #define TE_CORE_LOG_ERROR(channel, message) ((void)0)
279 #ifdef TERRALIB_LOGGER_FATAL_ENABLED
280 #define TE_CORE_LOG_FATAL(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::fatal)
282 #define TE_CORE_LOG_FATAL(channel, message) ((void)0)
294 #define TE_LOG_TRACE(message) TE_CORE_LOG_TRACE(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message)
305 #define TE_LOG_DEBUG(message) TE_CORE_LOG_DEBUG(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message)
316 #define TE_LOG_INFO(message) TE_CORE_LOG_INFO(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message)
327 #define TE_LOG_WARN(message)TE_CORE_LOG_WARN(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message)
338 #define TE_LOG_ERROR(message) TE_CORE_LOG_ERROR(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message)
349 #define TE_LOG_FATAL(message) TE_CORE_LOG_FATAL(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message)
351 #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.