Menu

LevelTrace

rwaury

Provides functions for simple creation of traces at four levels (none, error, info and debug).

The default trace level is info, debug if _DEBUG flag is set.


Files

LevelTrace.cpp
LevelTrace.h


Functions

Trace Functions

TPRINT(x)

Always printed.

TERROR(x)

Printed if TRACELEVEL_ERROR or higher enabled.

TINFO(x)

Printed if TRACELEVEL_INFO or higher enabled.

TDEBUG(x)

Printed if TRACELEVEL_DEBUG enabled.

Options

GetMaxTraceLevel()

returns current trace level.

TRACELEVEL_NONE
TRACELEVEL_ERROR
TRACELEVEL_INFO
TRACELEVEL_DEBUG

SetMaxTraceLevel(unsigned Level)

Changes trace level.

bool SetLevelTraceFunction(LevelTraceFunction_t Function, void *UserPtr)

Creates custom trace function.


Usage

Trace macros work like printf() functions. The input to the trace functions must be surrounded by a two sets of parenthesis.

TINFO(("Trace output of a %s","string"));

A user defined Trace Function can be set with:

  • SetLevelTraceFunction()

The user trace function can also call back to the default console trace function:

  • Default_TraceLevelFunction(NULL,Level,Format,Args);

Related

Wiki: Home

MongoDB Logo MongoDB