#ifndef __TLC_DBG_H__
#define __TLC_DBG_H__
#ifdef __cplusplus
extern "C" {
#endif

//#define USE_DEBUG_MESSAGE  //default disable

#define LOG_TAG "tlcTad"
#if defined USE_QSEE

#if defined USE_NDK_SYSROOT

#include <android/log.h>

#define LOG_i(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOG_e(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define LOG_d(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

#define printI(msg, ...)	    do { LOG_i(msg, ##__VA_ARGS__); } while (FALSE)
#ifdef USE_DEBUG_MESSAGE
#define printE(msg, ...)	    do { LOG_e("[ERROR](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)	    do { LOG_d("[DEBUG](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#else   //USE_DEBUG_MESSAGE
#define printE(msg, ...)	    do { LOG_e("[ERROR] " msg, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)
#endif  //USE_DEBUG_MESSAGE

#else   //USE_NDK_SYSROOT

#include <log/log.h>

#define printI(msg, ...)        do { ALOGD(msg, ##__VA_ARGS__); } while (FALSE)
#ifdef USE_DEBUG_MESSAGE
#define printE(msg, ...)        do { ALOGE("[ERROR](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)        do { ALOGD("[DEBUG](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#else   //USE_DEBUG_MESSAGE
#define printE(msg, ...)        do { ALOGE("[ERROR] " msg, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)
#endif  //USE_DEBUG_MESSAGE

#endif  //USE_NDK_SYSROOT


#elif defined USE_MOBICORE
#include "log.h"

#define LOG_i(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOG_e(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

#define printI(msg, ...)        do { LOG_i(msg, ##__VA_ARGS__); } while (FALSE)
#ifdef USE_DEBUG_MESSAGE
#define printE(msg, ...)        do { LOG_e("[ERROR](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)        do { LOG_i("[DEBUG](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#else   //USE_DEBUG_MESSAGE
#define printE(msg, ...)        do { LOG_e("[ERROR] " msg, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)
#endif  //USE_DEBUG_MESSAGE


#elif defined USE_TEEGRIS
#include <android/log.h>

#define LOG_i(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOG_e(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

#define printI(msg, ...)        do { LOG_i(msg, ##__VA_ARGS__); } while (FALSE)
#ifdef USE_DEBUG_MESSAGE
#define printE(msg, ...)        do { LOG_e("[ERROR](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)        do { LOG_i("[DEBUG](%s) " msg, __func__, ##__VA_ARGS__); } while (FALSE)
#else   //USE_DEBUG_MESSAGE
#define printE(msg, ...)        do { LOG_e("[ERROR] " msg, ##__VA_ARGS__); } while (FALSE)
#define printD(msg, ...)
#endif  //USE_DEBUG_MESSAGE


#else
#error "not prepared"
#endif


#ifdef __cplusplus
}
#endif
#endif
