25 #ifndef __I6ENGINE_UTILS_LOGGER_H__
26 #define __I6ENGINE_UTILS_LOGGER_H__
30 #include "i6engine/i6engineBuildSettings.h"
32 #ifdef ISIXE_WITH_LOGGING
36 #include "boost/log/common.hpp"
37 #include "boost/log/core.hpp"
38 #include "boost/log/sinks.hpp"
41 #ifdef ISIXE_WITH_LOGGING
42 #define ISIXE_LOG_DEBUG(module, message) {\
43 std::stringstream logMessageString; \
44 logMessageString << message; \
45 i6e::utils::Logger::GetSingleton().LogMessage(i6e::utils::LogLevel::LOGDEBUG, __FILE__, __LINE__, module, logMessageString.str());\
47 #define ISIXE_LOG_INFO(module, message) {\
48 std::stringstream logMessageString; \
49 logMessageString << message; \
50 i6e::utils::Logger::GetSingleton().LogMessage(i6e::utils::LogLevel::LOGINFO, __FILE__, __LINE__, module, logMessageString.str());\
52 #define ISIXE_LOG_WARN(module, message) {\
53 std::stringstream logMessageString; \
54 logMessageString << message; \
55 i6e::utils::Logger::GetSingleton().LogMessage(i6e::utils::LogLevel::LOGWARN, __FILE__, __LINE__, module, logMessageString.str());\
57 #define ISIXE_LOG_ERROR(module, message) {\
58 std::stringstream logMessageString; \
59 logMessageString << message; \
60 i6e::utils::Logger::GetSingleton().LogMessage(i6e::utils::LogLevel::LOGERROR, __FILE__, __LINE__, module, logMessageString.str());\
62 #define ISIXE_LOG_FATAL(module, message) {\
63 std::stringstream logMessageString; \
64 logMessageString << message; \
65 i6e::utils::Logger::GetSingleton().LogMessage(i6e::utils::LogLevel::LOGFATAL, __FILE__, __LINE__, module, logMessageString.str());\
68 #define ISIXE_LOG_SETLEVEL(level) {\
69 i6e::utils::Logger::GetSingleton().setLogLevel(level);\
72 #define ISIXE_LOG_DEBUG(module, message) {\
74 #define ISIXE_LOG_INFO(module, message) {\
76 #define ISIXE_LOG_WARN(module, message) {\
78 #define ISIXE_LOG_ERROR(module, message) {\
80 #define ISIXE_LOG_FATAL(module, message) {\
83 #define ISIXE_LOG_SETLEVEL(level) {\
85 #endif // ISIXE_WITH_LOGGING
90 static const std::string
logEnumNames[] = {
"Debug",
"Info",
"Warning",
"ERROR",
"FATAL",
"---" };
104 #ifdef ISIXE_WITH_LOGGING
107 typedef boost::log::sinks::synchronous_sink<boost::log::sinks::text_ostream_backend> TextSink;
108 typedef boost::shared_ptr<TextSink> SinkPtr;
109 typedef boost::shared_ptr<Logger> LogPtr;
130 inline void setLogLevel(
const LogLevel logLevel) { _logLevel = logLevel; }
135 void LogMessage(
LogLevel level,
const std::string & file,
const int line,
const std::string & module,
const std::string & message);
141 boost::log::sources::channel_logger_mt<std::string> _logger;
LogLevel
Defines values to specify severity/importance of log message.
Derive from this templated class to make a class a singleton. Refer to the Singleton Design Pattern i...
static const std::string logEnumNames[]