TrueReality  v0.1.1912
Log.h File Reference
#include <trUtil/Export.h>
#include <trUtil/DateTime.h>
#include <trUtil/Logging/LogFile.h>
#include <trUtil/Logging/LogLevel.h>
#include <string>
#include <cstdarg>
#include <vector>
#include <sstream>
#include <osg/Referenced>
#include <osg/ref_ptr>
Include dependency graph for Log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  trUtil::Logging::Log
 Log class which the engine uses for all of its logging needs. More...
 
struct  trUtil::Logging::Log::LogTestData
 A data structure that is used for Unit Tests. More...
 
class  trUtil::Logging::LoggingOff
 Scoped variable to turn off logging (except for always) for a block of code. More...
 

Namespaces

 trUtil::Logging
 

Macros

#define TR_LOG_SOURCE   __FILE__, __FUNCTION__, __LINE__
 Helps making logging a little easier. More...
 
#define LOG_FULL(level, name, msg)
 Logging macro to make error recording esier. More...
 
#define LOGN_D(name, msg)   LOG_FULL(trUtil::Logging::LogLevel::LOG_DEBUG, name, msg)
 Log a DEBUG message. More...
 
#define LOGN_I(name, msg)   LOG_FULL(trUtil::Logging::LogLevel::LOG_INFO, name, msg)
 Log an INFO message. More...
 
#define LOGN_W(name, msg)   LOG_FULL(trUtil::Logging::LogLevel::LOG_WARNING, name, msg)
 Log a WARNING message. More...
 
#define LOGN_E(name, msg)   LOG_FULL(trUtil::Logging::LogLevel::LOG_ERROR, name, msg)
 Log an ERROR message. More...
 
#define LOGN_A(name, msg)   LOG_FULL(trUtil::Logging::LogLevel::LOG_ALWAYS, name, msg)
 Log an ALWAYS message. More...
 
#define LOG_D(msg)   LOGN_D(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)
 Log a DEBUG message. More...
 
#define LOG_I(msg)   LOGN_I(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)
 Log an INFO message. More...
 
#define LOG_W(msg)   LOGN_W(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)
 Log a WARNING message. More...
 
#define LOG_E(msg)   LOGN_E(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)
 Log an ERROR message. More...
 
#define LOG_A(msg)   LOGN_A(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)
 Log an ALWAYS message. More...
 
#define LOG_PRINT_TEST
 Prints out a message to the Logger with a test string for every log level Only the currently enabled log levels will be visible The Log messages will only go to the enabled Log Writers This would be used for testing and development. More...
 

Macro Definition Documentation

◆ LOG_A

#define LOG_A (   msg)    LOGN_A(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)

Log an ALWAYS message.

Parameters
msg- Message to log.

Definition at line 174 of file Log.h.

Referenced by trUtil::DefaultSettings::SetupLoggingOptions().

◆ LOG_D

#define LOG_D (   msg)    LOGN_D(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)

◆ LOG_E

◆ LOG_FULL

#define LOG_FULL (   level,
  name,
  msg 
)
Value:
{\
trUtil::Logging::Log& logger = trUtil::Logging::Log::GetInstance(name); \
if (logger.IsLevelEnabled(level)) \
{\
std::ostringstream st;\
st << msg;\
logger.LogMessage(TR_LOG_SOURCE, st.str(), level); \
}\
}\
#define TR_LOG_SOURCE
Helps making logging a little easier.
Definition: Log.h:59
static Log & GetInstance(const std::string &name=Log::LOG_DEFAULT_NAME)
Retrieve singleton instance of the log class for a give string name.
Definition: Log.cpp:203

Logging macro to make error recording esier.

Parameters
level- Level of Logging (ERROR, WARNING, etc)
name- Name of the Log file.
msg- Message to log.

Definition at line 70 of file Log.h.

◆ LOG_I

#define LOG_I (   msg)    LOGN_I(trUtil::Logging::Log::LOG_DEFAULT_NAME, msg)

Log an INFO message.

Parameters
msg- Message to log.

Definition at line 147 of file Log.h.

◆ LOG_PRINT_TEST

#define LOG_PRINT_TEST
Value:
LOG_D("Test Message") \
LOG_I("Test Message") \
LOG_W("Test Message") \
LOG_E("Test Message") \
LOG_A("Test Message")
#define LOG_D(msg)
Log a DEBUG message.
Definition: Log.h:138

Prints out a message to the Logger with a test string for every log level Only the currently enabled log levels will be visible The Log messages will only go to the enabled Log Writers This would be used for testing and development.

Definition at line 183 of file Log.h.

◆ LOG_W

◆ LOGN_A

#define LOGN_A (   name,
  msg 
)    LOG_FULL(trUtil::Logging::LogLevel::LOG_ALWAYS, name, msg)

Log an ALWAYS message.

Parameters
name- Log File Name.
msg- Message to log.

Definition at line 129 of file Log.h.

◆ LOGN_D

#define LOGN_D (   name,
  msg 
)    LOG_FULL(trUtil::Logging::LogLevel::LOG_DEBUG, name, msg)

Log a DEBUG message.

Parameters
name- Log File Name.
msg- Message to log.

Definition at line 89 of file Log.h.

◆ LOGN_E

#define LOGN_E (   name,
  msg 
)    LOG_FULL(trUtil::Logging::LogLevel::LOG_ERROR, name, msg)

Log an ERROR message.

Parameters
name- Log File Name.
msg- Message to log.

Definition at line 119 of file Log.h.

◆ LOGN_I

#define LOGN_I (   name,
  msg 
)    LOG_FULL(trUtil::Logging::LogLevel::LOG_INFO, name, msg)

Log an INFO message.

Parameters
name- Log File Name.
msg- Message to log.

Definition at line 99 of file Log.h.

◆ LOGN_W

#define LOGN_W (   name,
  msg 
)    LOG_FULL(trUtil::Logging::LogLevel::LOG_WARNING, name, msg)

Log a WARNING message.

Parameters
name- Log File Name.
msg- Message to log.

Definition at line 109 of file Log.h.

◆ TR_LOG_SOURCE

#define TR_LOG_SOURCE   __FILE__, __FUNCTION__, __LINE__

Helps making logging a little easier.

However, if printf style logging is desired, you cannot use this macro.

Definition at line 59 of file Log.h.