Skip to content

Commit

Permalink
Adding debug file to bluetooth.
Browse files Browse the repository at this point in the history
* more changes will come.
  • Loading branch information
ModeenF committed Jan 12, 2013
1 parent f3e36d5 commit 34dad10
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions 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 <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_ */

0 comments on commit 34dad10

Please sign in to comment.