30 #ifndef __TERRALIB_CORE_LOGGER_LOGGER_H__ 31 #define __TERRALIB_CORE_LOGGER_LOGGER_H__ 35 #include "../Config.h" 36 #include "../utils/Platform.h" 38 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS 39 #define CURRENT_FUNCTION std::string(__FUNCTION__) 41 #define CURRENT_FUNCTION std::string(__PRETTY_FUNCTION__) 91 void log(
const std::string& message,
const std::string &channel,
severity_level severity);
100 void addLoggerFromFile(
const std::string &filename);
114 void addLogger(
const std::string &name,
const std::string &filename, std::string format);
123 bool exists(
const std::string &name);
128 void removeAllLoggers();
165 #ifdef TERRALIB_LOGGER_ENABLED 166 #define TE_ADD_LOGGER(name, filename, format) te::core::Logger::instance().addLogger(name, filename, format) 168 #define TE_ADD_LOGGER(name, filename, format) ((void)0) 181 #ifdef TERRALIB_LOGGER_ENABLED 182 #define TE_ADD_LOGGER_FROM_FILE(filename) te::core::Logger::instance().addLoggerFromFile(filename) 184 #define TE_ADD_LOGGER_FROM_FILE(filename) ((void)0) 194 #ifdef TERRALIB_LOGGER_ENABLED 195 #define TE_INIT_DEFAULT_LOGGER(filename) te::core::Logger::instance().addLogger(TERRALIB_DEFAULT_LOGGER, filename, TERRALIB_DEFAULT_LOGGER_FORMAT) 197 #define TE_INIT_DEFAULT_LOGGER(filename) ((void)0) 208 #ifdef TERRALIB_LOGGER_TRACE_ENABLED 209 #define TE_CORE_LOG_TRACE(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::trace) 211 #define TE_CORE_LOG_TRACE(channel, message) ((void)0) 222 #ifdef TERRALIB_LOGGER_DEBUG_ENABLED 223 #define TE_CORE_LOG_DEBUG(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::debug) 225 #define TE_CORE_LOG_DEBUG(channel, message) ((void)0) 236 #ifdef TERRALIB_LOGGER_INFO_ENABLED 237 #define TE_CORE_LOG_INFO(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::info) 239 #define TE_CORE_LOG_INFO(channel, message) ((void)0) 250 #ifdef TERRALIB_LOGGER_WARN_ENABLED 251 #define TE_CORE_LOG_WARN(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::warning) 253 #define TE_CORE_LOG_WARN(channel, message) ((void)0) 264 #ifdef TERRALIB_LOGGER_ERROR_ENABLED 265 #define TE_CORE_LOG_ERROR(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::error) 267 #define TE_CORE_LOG_ERROR(channel, message) ((void)0) 278 #ifdef TERRALIB_LOGGER_FATAL_ENABLED 279 #define TE_CORE_LOG_FATAL(channel, message) te::core::Logger::instance().log(message, channel ,te::core::Logger::severity_level::fatal) 281 #define TE_CORE_LOG_FATAL(channel, message) ((void)0) 293 #define TE_LOG_TRACE(message) TE_CORE_LOG_TRACE(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 304 #define TE_LOG_DEBUG(message) TE_CORE_LOG_DEBUG(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 315 #define TE_LOG_INFO(message) TE_CORE_LOG_INFO(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 326 #define TE_LOG_WARN(message)TE_CORE_LOG_WARN(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 337 #define TE_LOG_ERROR(message) TE_CORE_LOG_ERROR(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 348 #define TE_LOG_FATAL(message) TE_CORE_LOG_FATAL(TERRALIB_DEFAULT_LOGGER, CURRENT_FUNCTION + " : " + message) 350 #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.