52 #include <visp3/core/vpConfig.h>
56 #define __FUNCTION__ " "
61 #define VP_DEBUG_MODE 0
135 const char *currentFile;
136 const char *currentFunc;
155 vpTraceOutput(
const char *file,
int line,
const char *func,
bool error =
false,
const char *s = NULL)
156 : currentFile(file), currentFunc(func), currentLine(line), err(error), header(s)
168 if (VP_DEBUG_MODE >= level) {
171 va_start(args, format);
174 std::cerr <<
"(L" << level <<
") ";
176 std::cout <<
"(L" << level <<
") ";
193 va_start(args, format);
196 std::cout <<
"(L0) ";
214 void display(
const char *format, va_list args)
222 std::cerr <<
"!!\t" << currentFile <<
": " << currentFunc <<
"(#" << currentLine <<
") : ";
224 vfprintf(stderr, format, args);
225 fprintf(stderr,
"\n");
233 std::cout << currentFile <<
": " << currentFunc <<
"(#" << currentLine <<
") : ";
235 vprintf(format, args);
270 #define vpIN_FCT (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "begin "))
290 #define vpOUT_FCT (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "end "))
294 inline void vpIN_FCT(
const char * , ...) {}
295 inline void vpOUT_FCT(
const char * , ...) {}
333 #define vpCTRACE std::cout << "(L0) " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
361 std::cerr << "(L0) " \
362 << "!!\t" << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
388 #define vpERROR_TRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))
411 #define vpTRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))
424 inline void vpTRACE(
const char * , ...) {}
425 inline void vpTRACE(
int ,
const char * , ...) {}
459 #define vpDERROR_TRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))
482 #define vpDEBUG_TRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))
506 #define vpCDEBUG(level) \
507 if (VP_DEBUG_MODE < level) \
510 std::cout << "(L" << level << ") " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
533 #define vpDEBUG_ENABLE(level) (VP_DEBUG_MODE >= level)
542 #define vpCDEBUG(level) \
545 #define vpDEBUG_ENABLE(level) (false)
556 #define DEFENSIF(a) (a)
558 #define DEFENSIF(a) (0)
This class is used to display debug or error messages.
vpTraceOutput(const char *file, int line, const char *func, bool error=false, const char *s=NULL)
void operator()(const char *format,...)
void operator()(int level, const char *format,...)
void display(const char *format, va_list args)