Browse Source

Support logging debug information to logcat on Android.

master
Reece H. Dunn 12 years ago
parent
commit
c73686c9eb
1 changed files with 26 additions and 2 deletions
  1. 26
    2
      src/debug.h

+ 26
- 2
src/debug.h View File

@@ -3,10 +3,31 @@

//#define DEBUG_ENABLED

#ifdef ANDROID

#include <android/log.h>
#define LOG_TAG "eSpeak"

#ifdef DEBUG_ENABLED
#define ENTER(text) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, text)
#define SHOW(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#else
#define ENTER(text)
#define SHOW(format,...)
#endif

#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define SHOW_TIME(text)

#else

#ifdef DEBUG_ENABLED

#define ENTER(text) debug_enter(text)
#define SHOW(format,...) debug_show(format,__VA_ARGS__);
#define LOGE(format,...) debug_show(format,__VA_ARGS__);
#define SHOW_TIME(text) debug_time(text);

extern void debug_enter(const char* text);
extern void debug_show(const char* format,...);
extern void debug_time(const char* text);
@@ -15,12 +36,15 @@ extern void debug_time(const char* text);

#ifdef NO_VARIADIC_MACROS
#define SHOW(format) // VC6 doesn't allow "..."
#define LOGE(format) // VC6 doesn't allow "..."
#else
#define SHOW(format,...)
#define LOGE(format,...)
#endif

#define SHOW_TIME(text)
#define ENTER(text)
#endif


#endif
#endif
#endif

Loading…
Cancel
Save