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); }
106
static
int
log(
int
level,
const
char* fmt, ...)
109
va_start(arglist, fmt);
110
int
ret = instance()._log(level,fmt,arglist);
115
#define LOG_METHOD(NAME,LEVEL) \
116
static int NAME(const char* fmt, ...) \
120
int ret = instance()._log(LEVEL, fmt, ap); \
125
LOG_METHOD(fatal, FLANN_LOG_FATAL)
126
LOG_METHOD(
error, FLANN_LOG_ERROR)
127
LOG_METHOD(warn, FLANN_LOG_WARN)
128
LOG_METHOD(info, FLANN_LOG_INFO)
CV_EXPORTS_W void log(InputArray src, OutputArray dst)
Calculates the natural logarithm of every array element.
CV_EXPORTS CV_NORETURN void error(const Exception &exc)
Signals an error and raises the exception.