TexGen
Classes | Namespaces | Macros | Functions
Logger.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TexGen::CLogIndent
 Class to handle log indenting. More...
 
class  TexGen::CLogger
 Abstract base class to act as an interface between texgen and the logger. More...
 
class  TexGen::CLoggerScreen
 Logger used to print all log and error messages to the screen. More...
 
class  TexGen::CLoggerNull
 Logger used to send all log and error messages into a black hole. More...
 

Namespaces

namespace  TexGen
 Namespace containing a series of customised math operations not found in the standard c++ library.
 

Macros

#define TGERROR(MESSAGE)
 Macros used to report the file name and line number to the TexGenError and TexGenLog functions. More...
 
#define TGLOG(MESSAGE)
 
#define TGLOGINCREASEINDENT()
 Macros to increase and decrease indentation in the logging. More...
 
#define TGLOGDECREASEINDENT()
 
#define TGLOGAUTOINDENT()   CLogIndent AutoLogIndentVariable;
 
#define TGLOGINDENT(MESSAGE)   TGLOG(MESSAGE) TGLOGAUTOINDENT()
 Combines the TGLOG macro and TGLOGAUTOINDENT macro in one. More...
 

Functions

CLoggerTexGen::GetLogger ()
 

Macro Definition Documentation

◆ TGERROR

#define TGERROR (   MESSAGE)
Value:
{ \
std::ostringstream o; \
o << MESSAGE; \
GetLogger().TexGenError(__FILE__, __LINE__, o.str()); \
}

Macros used to report the file name and line number to the TexGenError and TexGenLog functions.

Also converts stream to string making it easier to insert values into the error message without need to use the stringify function. E.g. TEXGENERROR("Value is not high enough: " << iValue);

Definition at line 29 of file Logger.h.

◆ TGLOG

#define TGLOG (   MESSAGE)
Value:
{ \
std::ostringstream o; \
o << MESSAGE; \
GetLogger().TexGenLog(__FILE__, __LINE__, o.str()); \
}

Definition at line 36 of file Logger.h.

◆ TGLOGAUTOINDENT

#define TGLOGAUTOINDENT ( )    CLogIndent AutoLogIndentVariable;

Definition at line 65 of file Logger.h.

◆ TGLOGDECREASEINDENT

#define TGLOGDECREASEINDENT ( )
Value:
{ \
GetLogger().DecreaseIndent(); \
}

Definition at line 60 of file Logger.h.

◆ TGLOGINCREASEINDENT

#define TGLOGINCREASEINDENT ( )
Value:
{ \
GetLogger().IncreaseIndent(); \
}

Macros to increase and decrease indentation in the logging.

Indentation can be done in two ways, by calling INCREASELOGINDENT followed by DECREASELOGINDENT. Care must be taken to make sure that each INCREASELOGINDENT is ALWAYS matched with a DECREASELOGINDENT (it can be easy to get a miss match when a "return" occurs in the middle of a function).

A safer way to indent things is by calling AUTOLOGINDENT. This macro actually creates an instance of the CLogIndent class which has a constructor that calls INCREASELOGINDENT and destructor that calls DECREASELOGINDENT. Thus a call to increase indent is ALWAYS matched with a call to decrease indent. The decrease indent occurs when the variable exits the current scope, i.e. before exiting a function, an if statement, loop, etc... Note that this macro cannot be placed twice within the same control loop since the class instance will already be declared with the same name.

Definition at line 55 of file Logger.h.

◆ TGLOGINDENT

#define TGLOGINDENT (   MESSAGE)    TGLOG(MESSAGE) TGLOGAUTOINDENT()

Combines the TGLOG macro and TGLOGAUTOINDENT macro in one.

Definition at line 68 of file Logger.h.