Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* more changes will come.
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#ifndef _BLUETOOTH_DEBUG_SERVER_H_ | ||
#define _BLUETOOTH_DEBUG_SERVER_H_ | ||
|
||
#ifndef DEBUG | ||
#define DEBUG 3 | ||
#endif | ||
|
||
#include <Debug.h> | ||
#include <stdio.h> | ||
|
||
#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_ */ |