31 #ifndef FLANN_LOGGER_H
32 #define FLANN_LOGGER_H
49 if ((stream!=
NULL)&&(stream!=stdout)) {
60 void _setDestination(
const char*
name)
66 stream = fopen(
name,
"w");
73 int _log(
int level,
const char*
fmt, va_list arglist)
75 if (level > logLevel )
return -1;
76 int ret = vfprintf(stream,
fmt, arglist);
85 static void setLevel(
int level) { instance().logLevel = level; }
91 static int getLevel() {
return instance().logLevel; }
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); \
static void setDestination(const char *name)
static int debug(const char *fmt,...)
static void setLevel(int level)
static int error(const char *fmt,...)
static int warn(const char *fmt,...)
static int info(const char *fmt,...)
static int log(int level, const char *fmt,...)
static int fatal(const char *fmt,...)
#define LOG_METHOD(NAME, LEVEL)