gprintf debug routine syslog
//------------------------------------------------------------------------------
#include <android/log.h>
#define TAG "HoJNI"
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
#define GDEBUG
#ifdef GDEBUG
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
//#define gprintf(msg...) do { fprintf(stderr,"%s %s() %d: ", __FILE__, __FUNCTION__, __LINE__); fprintf (stderr,msg);} while (0)
#define gprintf(msg...) do { LOGE("%s:%d, %s(): %s", __FILENAME__, __LINE__, __FUNCTION__, msg);} while (0)
#else
#define gprintf(msg...)
#endif
//------------------------------------------------------------------------------
//C debug message with printf & fflush
//C debug message with fprintf
#define GDEBUG
#ifdef GDEBUG
# define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
# define gprintf(msg...) do { fprintf(stderr,"%s %s() %d: ", __FILE__, __FUNCTION__, __LINE__); fprintf (stderr,msg);} while (0)
#else
# define gprintf(msg...)
#endif
파일 이름 짧게
//----------------------------------------------------------------------------------------------------
#define GDEBUG
#ifdef GDEBUG
# define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
# define gprintf(msg...) do { fprintf(stderr,"%s %s() %d: ", __FILENAME__, __FUNCTION__, __LINE__); fprintf (stderr,msg);} while (0)
#else
# define gprintf(msg...)
#endif
//----------------------------------------------------------------------------------------------------
//ffmpeg debug message with av_log
#include <syslog.h>
'C & C++ 관련' 카테고리의 다른 글
_splitpath / 경로명에서 원하는 정보 분리하기 (0) | 2009.08.10 |
---|---|
스마트 포인터 (0) | 2009.07.26 |
auto_ptr의 두 얼굴 (0) | 2009.07.26 |