diff --git a/headers/private/bluetooth/debug.h b/headers/private/bluetooth/debug.h new file mode 100644 index 0000000000..6b1f8d0362 --- /dev/null +++ b/headers/private/bluetooth/debug.h @@ -0,0 +1,62 @@ +#ifndef _BLUETOOTH_DEBUG_SERVER_H_ +#define _BLUETOOTH_DEBUG_SERVER_H_ + +#ifndef DEBUG + #define DEBUG 3 +#endif + +#include +#include + +#undef TRACE +#undef PRINT +#if DEBUG > 0 + inline void ERROR(const char *fmt, ...) + { + va_list ap; + va_start(ap, fmt); + printf("### ERROR: "); + vprintf(fmt, ap); va_end(ap); + } +/* + inline void PRINT(int level, const char *fmt, ...) + { + va_list ap; + if (level > DEBUG) + return; + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } + + inline void PRINT(const char *fmt, ...) + { + va_list ap; + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + }*/ + + #if DEBUG >= 2 + #define TRACE(a...) printf("TRACE %s : %s\n", __PRETTY_FUNCTION__, a) + #else + #define TRACE(a...) ((void)0) + #endif + + #if DEBUG >= 3 + #define END() printf("ENDING %s\n",__PRETTY_FUNCTION__) + #define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__) + #else + #define END() ((void)0) + #define CALLED() ((void)0) + #endif +#else + #define END() ((void)0) + #define CALLED() ((void)0) + #define ERROR(a...) fprintf(stderr, a) + #define TRACE(a...) ((void)0) +#endif + +#define PRINT(l, a...) printf(l, a) + +#endif /* _BLUETOOTH_DEBUG_SERVER_H_ */