libIntegra
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Macros
trace.h File Reference

Defines tracing macros and class CTrace for configuration of tracing. More...

#include "common_typedefs.h"
#include <ostream>
#include <fstream>
Include dependency graph for trace.h:

Go to the source code of this file.

Classes

class  integra_api::CTrace
 Handles console output. More...
 

Macros

#define STRINGIFY(x)   #x
 
#define TOSTRING(x)   STRINGIFY(x)
 
#define INTEGRA_FUNCTION   TOSTRING(__FUNCTION__)
 
#define INTEGRA_LOCATION   __FILE__ ": " TOSTRING(__LINE__) "(" INTEGRA_FUNCTION ")"
 
#define INTEGRA_TRACE_ERROR   integra_api::CTrace::error( INTEGRA_LOCATION )
 Main error tracing macro. Usage example: INTEGRA_TRACE_ERROR << "Something unexpected happened! Details: " << some_details << of_mixed_type;. More...
 
#define INTEGRA_TRACE_PROGRESS   integra_api::CTrace::progress( INTEGRA_LOCATION )
 Main progress tracing macro. Usage example: INTEGRA_TRACE_PROGRESS << "A normal (not unexpected) thing happened. Details: " << some_details << of_mixed_type;. More...
 
#define INTEGRA_TRACE_VERBOSE   integra_api::CTrace::verbose( INTEGRA_LOCATION )
 Main verbose progress tracing macro. More...
 

Detailed Description

Defines tracing macros and class CTrace for configuration of tracing.

libIntegra tracing writes to stdout.

The main entrypoint for libIntegra tracing functionality are the macros INTEGRA_TRACE_ERROR, INTEGRA_TRACE_PROGRESS and INTEGRA_TRACE_VERBOSE.

These macros are exposed in libIntegra's api in order to allow users of the api to utilize the tracing system themselves, if they wish to.

Macro Definition Documentation

#define INTEGRA_FUNCTION   TOSTRING(__FUNCTION__)

Used internally by subsequent macros

#define INTEGRA_LOCATION   __FILE__ ": " TOSTRING(__LINE__) "(" INTEGRA_FUNCTION ")"

Used internally by subsequent macros

#define INTEGRA_TRACE_ERROR   integra_api::CTrace::error( INTEGRA_LOCATION )

Main error tracing macro. Usage example: INTEGRA_TRACE_ERROR << "Something unexpected happened! Details: " << some_details << of_mixed_type;.

Only traces anything when tracing of errors is enabled Automatically traces time, location and thread ID (subject to configuration).

#define INTEGRA_TRACE_PROGRESS   integra_api::CTrace::progress( INTEGRA_LOCATION )

Main progress tracing macro. Usage example: INTEGRA_TRACE_PROGRESS << "A normal (not unexpected) thing happened. Details: " << some_details << of_mixed_type;.

Only traces anything when tracing of progress is enabled Automatically traces time, location and thread ID (subject to configuration).

#define INTEGRA_TRACE_VERBOSE   integra_api::CTrace::verbose( INTEGRA_LOCATION )

Main verbose progress tracing macro.

The distinction between progress and verbose tracing allows very commonly-occuring actions to be only included when verbose tracing is enabled, preventing excessive tracing during normal operation.

Usage example: INTEGRA_TRACE_VERBOSE << "A normal (not unexpected) and frequently occurring thing happened. Details: " << some_details << of_mixed_type;

Only traces anything when verbose tracing is enabled Automatically traces time, location and thread ID (subject to configuration).

#define STRINGIFY (   x)    #x

Used internally by subsequent macros

#define TOSTRING (   x)    STRINGIFY(x)

Used internally by subsequent macros