|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _EI_LOGGING_H_ |
|
|
#define _EI_LOGGING_H_ |
|
|
|
|
|
#include <stdint.h> |
|
|
#include <stdarg.h> |
|
|
|
|
|
#include "ei_classifier_porting.h" |
|
|
|
|
|
#define EI_LOG_LEVEL_NONE 0 |
|
|
#define EI_LOG_LEVEL_ERROR 1 |
|
|
#define EI_LOG_LEVEL_WARNING 2 |
|
|
#define EI_LOG_LEVEL_INFO 3 |
|
|
#define EI_LOG_LEVEL_DEBUG 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define EI_LOGE(format, ...) (void)0 |
|
|
#define EI_LOGW(format, ...) (void)0 |
|
|
#define EI_LOGI(format, ...) (void)0 |
|
|
#define EI_LOGD(format, ...) (void)0 |
|
|
|
|
|
#ifndef EI_LOG_LEVEL |
|
|
#define EI_LOG_LEVEL EI_LOG_LEVEL_NONE |
|
|
#endif |
|
|
|
|
|
#if defined(__cplusplus) && EI_C_LINKAGE == 1 |
|
|
extern "C" |
|
|
#endif |
|
|
|
|
|
const char *debug_msgs[] = |
|
|
{ |
|
|
"NONE", |
|
|
"ERR", |
|
|
"WARNING", |
|
|
"INFO", |
|
|
"DEBUG" |
|
|
}; |
|
|
|
|
|
#if EI_LOG_LEVEL >= EI_LOG_LEVEL_ERROR |
|
|
#ifdef EI_LOGE |
|
|
#undef EI_LOGE |
|
|
#endif |
|
|
#define EI_LOGE(format, ...) ei_printf("%s: ",debug_msgs[EI_LOG_LEVEL_ERROR]); ei_printf(format, ##__VA_ARGS__); |
|
|
#endif |
|
|
|
|
|
#if EI_LOG_LEVEL >= EI_LOG_LEVEL_WARNING |
|
|
#ifdef EI_LOGW |
|
|
#undef EI_LOGW |
|
|
#endif |
|
|
#define EI_LOGW(format, ...) ei_printf("%s: ",debug_msgs[EI_LOG_LEVEL_WARNING]); ei_printf(format, ##__VA_ARGS__); |
|
|
#endif |
|
|
|
|
|
#if EI_LOG_LEVEL >= EI_LOG_LEVEL_INFO |
|
|
#ifdef EI_LOGI |
|
|
#undef EI_LOGI |
|
|
#endif |
|
|
#define EI_LOGI(format, ...) ei_printf("%s: ",debug_msgs[EI_LOG_LEVEL_INFO]); ei_printf(format, ##__VA_ARGS__); |
|
|
#endif |
|
|
|
|
|
#if EI_LOG_LEVEL >= EI_LOG_LEVEL_DEBUG |
|
|
#ifdef EI_LOGD |
|
|
#undef EI_LOGD |
|
|
#endif |
|
|
#define EI_LOGD(format, ...) ei_printf("%s: ",debug_msgs[EI_LOG_LEVEL_DEBUG]); ei_printf(format, ##__VA_ARGS__); |
|
|
#endif |
|
|
|
|
|
#endif |