1*433d6423SLionel Sambuc #ifndef DDEKIT_DEBUG_H 2*433d6423SLionel Sambuc #define DDEKIT_DEBUG_H 3*433d6423SLionel Sambuc #include <ddekit/ddekit.h> 4*433d6423SLionel Sambuc #include <ddekit/printf.h> 5*433d6423SLionel Sambuc 6*433d6423SLionel Sambuc #define DDEBUG_QUIET 0 7*433d6423SLionel Sambuc #define DDEBUG_ERR 1 8*433d6423SLionel Sambuc #define DDEBUG_WARN 2 9*433d6423SLionel Sambuc #define DDEBUG_INFO 3 10*433d6423SLionel Sambuc #define DDEBUG_VERBOSE 4 11*433d6423SLionel Sambuc 12*433d6423SLionel Sambuc #define DDEBUG_MEM DDEBUG_INFO 13*433d6423SLionel Sambuc 14*433d6423SLionel Sambuc #define DDEBUG_MSG_ERR(fmt, ...) 15*433d6423SLionel Sambuc #define DDEBUG_MSG_WARN(fmt, ...) 16*433d6423SLionel Sambuc #define DDEBUG_MSG_INFO(fmt, ...) 17*433d6423SLionel Sambuc #define DDEBUG_MSG_VERBOSE(fmt, ...) 18*433d6423SLionel Sambuc 19*433d6423SLionel Sambuc #if DDEBUG >= DDEBUG_ERR 20*433d6423SLionel Sambuc #undef DDEBUG_MSG_ERR 21*433d6423SLionel Sambuc #define DDEBUG_MSG_ERR(fmt, ...) ddekit_printf("%s : "fmt"\n", __func__, ##__VA_ARGS__ ) 22*433d6423SLionel Sambuc #endif 23*433d6423SLionel Sambuc 24*433d6423SLionel Sambuc #if DDEBUG >= DDEBUG_WARN 25*433d6423SLionel Sambuc #undef DDEBUG_MSG_WARN 26*433d6423SLionel Sambuc #define DDEBUG_MSG_WARN(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ ) 27*433d6423SLionel Sambuc #endif 28*433d6423SLionel Sambuc 29*433d6423SLionel Sambuc #if DDEBUG >= DDEBUG_INFO 30*433d6423SLionel Sambuc #undef DDEBUG_MSG_INFO 31*433d6423SLionel Sambuc #define DDEBUG_MSG_INFO(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ ) 32*433d6423SLionel Sambuc #endif 33*433d6423SLionel Sambuc 34*433d6423SLionel Sambuc #if DDEBUG >= DDEBUG_VERBOSE 35*433d6423SLionel Sambuc #undef DDEBUG_MSG_VERBOSE 36*433d6423SLionel Sambuc #define DDEBUG_MSG_VERBOSE(fmt, ...) ddekit_printf("%s: "fmt"\n", __func__, ##__VA_ARGS__ ) 37*433d6423SLionel Sambuc #endif 38*433d6423SLionel Sambuc 39*433d6423SLionel Sambuc #endif 40*433d6423SLionel Sambuc 41*433d6423SLionel Sambuc 42