41 #include <osg/Referenced> 42 #include <osg/ref_ptr> 59 #define TR_LOG_SOURCE __FILE__, __FUNCTION__, __LINE__ 70 #define LOG_FULL(level, name, msg) \ 72 trUtil::Logging::Log& logger = trUtil::Logging::Log::GetInstance(name); \ 73 if (logger.IsLevelEnabled(level)) \ 75 std::ostringstream st;\ 77 logger.LogMessage(TR_LOG_SOURCE, st.str(), level); \ 89 #define LOGN_D(name, msg) LOG_FULL(trUtil::Logging::LogLevel::LOG_DEBUG, name, msg) 99 #define LOGN_I(name, msg) LOG_FULL(trUtil::Logging::LogLevel::LOG_INFO, name, msg) 109 #define LOGN_W(name, msg) LOG_FULL(trUtil::Logging::LogLevel::LOG_WARNING, name, msg) 119 #define LOGN_E(name, msg) LOG_FULL(trUtil::Logging::LogLevel::LOG_ERROR, name, msg) 129 #define LOGN_A(name, msg) LOG_FULL(trUtil::Logging::LogLevel::LOG_ALWAYS, name, msg) 138 #define LOG_D(msg) LOGN_D(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg) 147 #define LOG_I(msg) LOGN_I(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg) 156 #define LOG_W(msg) LOGN_W(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg) 165 #define LOG_E(msg) LOGN_E(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg) 174 #define LOG_A(msg) LOGN_A(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg) 183 #define LOG_PRINT_TEST \ 184 LOG_D("Test Message") \ 185 LOG_I("Test Message") \ 186 LOG_W("Test Message") \ 187 LOG_E("Test Message") \ 188 LOG_A("Test Message") 231 void LogMessage(
const std::string& cppFile,
const std::string& method,
int line,
const std::string& msg, LogLevel logLevel)
const;
247 void LogMessage(LogLevel logLevel,
const std::string& source,
int line,
const char* msg, ...)
const;
262 void LogMessage(LogLevel logLevel,
const std::string& source,
int line,
const std::string& msg)
const;
278 void LogMessage(LogLevel logLevel,
const std::string& source,
int line,
const char* msg, va_list list)
const;
293 void LogMessage(LogLevel logLevel,
const std::string &source,
const char *msg, ...)
const;
311 bool IsLevelEnabled(LogLevel logLevel)
const;
321 void SetLogLevel(LogLevel logLevel);
330 LogLevel GetLogLevel()
const;
341 static const std::string GetLogLevelString(LogLevel logLevel);
352 static LogLevel GetLogLevelForString(
const std::string& levelString);
375 static void SetDefaultLogLevel(LogLevel newLevel);
386 static void SetAllLogLevels(LogLevel newLevel);
452 NO_OUTPUT = 0x00000000,
453 TO_FILE = 0x00000001,
454 TO_CONSOLE = 0x00000002,
455 TO_WRITER = 0x00000004,
456 STANDARD = TO_FILE | TO_CONSOLE | TO_WRITER
472 void SetOutputStreamBit(
unsigned int option);
481 static void SetAllOutputStreamBits(
unsigned int option);
490 unsigned int GetOutputStreamBit()
const;
499 const std::string& GetName()
const;
517 void SetTestMode(
bool state);
538 Log(
const std::string& name);
550 bool mTestingMode =
false;
Log class which the engine uses for all of its logging needs.
trUtil::Logging::LogLevel logLevel
Interface class get the time for the logger.
std::string file
The name of the Log instance (could be empty)
int line
The calling method of the message.
Scoped variable to turn off logging (except for always) for a block of code.
std::string msg
The line number of the source code of the message.
std::vector< osg::ref_ptr< LogWriter > > LogWriterContainer
The log writer container.
A data structure that is used for Unit Tests.
OutputStreamOptions
Values that represent output stream options.
Interface class to receive messages from the Log.
std::string logName
The frame number.
A class that represents date time utility.
trUtil::DateTime time
Log level.
static const std::string LOG_DEFAULT_NAME
unsigned frameNumber
Time of message.
std::string method
The source file of the message.
trUtil::Logging::Log & mLog