31 #ifndef OPENCV_FLANN_LOGGER_H
32 #define OPENCV_FLANN_LOGGER_H
47 Logger() : stream(stdout), logLevel(FLANN_LOG_WARN) {}
51 if ((stream!=NULL)&&(stream!=stdout)) {
56 static Logger& instance()
62 void _setDestination(
const char* name)
69 if (fopen_s(&stream, name,
"w") != 0)
72 stream =
fopen(name,
"w");
80 int _log(
int level,
const char* fmt,
va_list arglist)
82 if (level > logLevel )
return -1;
83 int ret =
vfprintf(stream, fmt, arglist);
92 static void setLevel(
int level) { instance().logLevel = level; }
98 static void setDestination(
const char* name) { instance()._setDestination(name); }
105 static int log(
int level,
const char* fmt, ...)
108 va_start(arglist, fmt);
109 int ret = instance()._log(level,fmt,arglist);
114 #define LOG_METHOD(NAME,LEVEL) \
115 static int NAME(const char* fmt, ...) \
119 int ret = instance()._log(LEVEL, fmt, ap); \
124 LOG_METHOD(fatal, FLANN_LOG_FATAL)
125 LOG_METHOD(
error, FLANN_LOG_ERROR)
126 LOG_METHOD(warn, FLANN_LOG_WARN)
127 LOG_METHOD(info, FLANN_LOG_INFO)
CV_EXPORTS CV_NORETURN void error(int _code, const String &_err, const char *_func, const char *_file, int _line)
Signals an error and raises the exception.
Quat< T > log(const Quat< T > &q, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)