52#include <visp3/core/vpConfig.h>
56#define __FUNCTION__ " "
61#define VP_DEBUG_MODE 0
156 vpTraceOutput(
const char *file,
int line,
const char *func,
bool error =
false,
const char *s =
nullptr)
157 : 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 <<
") ";
177 std::cout <<
"(L" << level <<
") ";
195 va_start(args, format);
198 std::cout <<
"(L0) ";
207#if defined(__clang__)
211# pragma clang diagnostic push
212# pragma clang diagnostic ignored "-Wformat-nonliteral"
221 void display(
const char *format, va_list args)
226 if (header !=
nullptr) {
230 std::cerr <<
"!!\t" << currentFile <<
": " << currentFunc <<
"(#" << currentLine <<
") : ";
232 vfprintf(stderr, format, args);
233 fprintf(stderr,
"\n");
239 if (header !=
nullptr) {
243 std::cout << currentFile <<
": " << currentFunc <<
"(#" << currentLine <<
") : ";
245 vprintf(format, args);
251#if defined(__clang__)
252# pragma clang diagnostic pop
256 const char *currentFile;
257 const char *currentFunc;
294#define vpIN_FCT (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "begin "))
318#define vpOUT_FCT (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false, "end "))
322inline void vpIN_FCT(
const char * , ...) { }
323inline void vpOUT_FCT(
const char * , ...) { }
362#define vpCTRACE std::cout << "(L0) " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
393#define vpCERROR std::cerr << "(L0) " << "!!\t" << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
423#define vpERROR_TRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))
450#define vpTRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))
463inline void vpTRACE(
const char * , ...) { }
464inline void vpTRACE(
int ,
const char * , ...) { }
499#define vpDERROR_TRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, true))
526#define vpDEBUG_TRACE (vpTraceOutput(__FILE__, __LINE__, __FUNCTION__, false))
554#define vpCDEBUG(level) \
555 if (VP_DEBUG_MODE < level) \
558 std::cout << "(L" << level << ") " << __FILE__ << ": " << __FUNCTION__ << "(#" << __LINE__ << ") : "
585#define vpDEBUG_ENABLE(level) (VP_DEBUG_MODE >= level)
594#define vpCDEBUG(level) \
597#define vpDEBUG_ENABLE(level) (false)
605#define DEFENSIF(a) (a)
607#define DEFENSIF(a) (0)
vpTraceOutput(const char *file, int line, const char *func, bool error=false, const char *s=nullptr)
void operator()(const char *format,...)
void operator()(int level, const char *format,...)
void display(const char *format, va_list args)