50 #include <visp3/core/vpConfig.h> 58 # define __FUNCTION__ " " 63 # define VP_DEBUG_MODE 0 138 const char* currentFile;
139 const char* currentFunc;
157 vpTraceOutput(
const char* file,
int line,
const char* func,
bool error=
false,
const char * s=NULL) :
173 if(VP_DEBUG_MODE >= level)
177 va_start(args, format);
180 std::cerr <<
"(L" << level <<
") " ;
182 std::cout <<
"(L" << level <<
") " ;
199 va_start(args, format);
220 void display(
const char* format, va_list args)
226 if(header != NULL) std::cerr<<header;
228 std::cerr <<
"!!\t" << currentFile <<
": " <<currentFunc <<
"(#" << currentLine <<
") : " ;
230 vfprintf (stderr, format, args);
231 fprintf (stderr,
"\n");
238 if(header != NULL) std::cout<<header;
240 std::cout <<currentFile <<
": " << currentFunc <<
"(#" << currentLine <<
") : " ;
242 vprintf (format, args);
256 #ifdef VP_TRACE // Activate the trace mode 276 #define vpIN_FCT (vpTraceOutput(__FILE__,__LINE__, __FUNCTION__, false, "begin ")) 297 #define vpOUT_FCT (vpTraceOutput(__FILE__,__LINE__, __FUNCTION__, false, "end ")) 299 #else // #ifdef VP_TRACE 301 inline void vpIN_FCT (
const char * , ...){}
302 inline void vpOUT_FCT (
const char * , ...){}
304 #endif // #ifdef VP_TRACE 337 #define vpCTRACE std::cout << "(L0) " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : " 365 #define vpCERROR std::cerr << "(L0) " << "!!\t" << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : " 391 #define vpERROR_TRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, true)) 414 #define vpTRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, false)) 416 #else // #ifdef VP_TRACE 418 #define vpCTRACE if(false) std::cout // Warning C4127 419 #define vpCERROR if(false) std::cerr // Warning C4127 423 inline void vpTRACE (
const char * , ...){}
424 inline void vpTRACE (
int ,
const char * , ...){}
426 #endif // #ifdef VP_TRACE 455 #define vpDERROR_TRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, true)) 478 #define vpDEBUG_TRACE (vpTraceOutput( __FILE__,__LINE__, __FUNCTION__, false)) 502 #define vpCDEBUG(level) if (VP_DEBUG_MODE < level) ; else \ 503 std::cout << "(L" << level << ") "<< __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : " 526 #define vpDEBUG_ENABLE(level) (VP_DEBUG_MODE >= level) 528 #else // #ifdef VP_DEBUG 535 #define vpCDEBUG(level) if(false) std::cout // Warning C4127 536 #define vpDEBUG_ENABLE(level) (false) // Warning C4127 538 #endif // #ifdef VP_DEBUG 544 #define DEFENSIF(a) (a) 546 #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)