added ZT_FLOW option for higher-level SDK debugging
This commit is contained in:
16
src/debug.h
16
src/debug.h
@@ -30,12 +30,13 @@
|
|||||||
#ifndef _SDK_DEBUG_H_
|
#ifndef _SDK_DEBUG_H_
|
||||||
#define _SDK_DEBUG_H_
|
#define _SDK_DEBUG_H_
|
||||||
|
|
||||||
#define DEBUG_LEVEL 1 // Set this to adjust what you'd like to see in the debug traces
|
#define DEBUG_LEVEL 4 // Set this to adjust what you'd like to see in the debug traces
|
||||||
|
|
||||||
#define MSG_ERROR 1 // Errors
|
#define MSG_ERROR 1 // Errors
|
||||||
#define MSG_TRANSFER 2 // RX/TX specific statements
|
#define MSG_TRANSFER 2 // RX/TX specific statements
|
||||||
#define MSG_INFO 3 // Information which is generally useful to any developer
|
#define MSG_INFO 3 // Information which is generally useful to any developer
|
||||||
#define MSG_EXTRA 4 // If nothing in your world makes sense
|
#define MSG_EXTRA 4 // If nothing in your world makes sense
|
||||||
|
#define MSG_FLOW 5 // High-level flow messages
|
||||||
|
|
||||||
#define __SHOW_FILENAMES__ true
|
#define __SHOW_FILENAMES__ true
|
||||||
#define __SHOW_COLOR__ true
|
#define __SHOW_COLOR__ true
|
||||||
@@ -91,6 +92,7 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
#define DEBUG_ERROR(fmt, args...)
|
#define DEBUG_ERROR(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG_LEVEL >= MSG_INFO
|
#if DEBUG_LEVEL >= MSG_INFO
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#define DEBUG_INFO(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:%20s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
#define DEBUG_INFO(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_INFO : %14s:%4d:%20s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||||
@@ -109,6 +111,7 @@ extern "C" {
|
|||||||
#define DEBUG_ATTN(fmt, args...)
|
#define DEBUG_ATTN(fmt, args...)
|
||||||
#define DEBUG_STACK(fmt, args...)
|
#define DEBUG_STACK(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG_LEVEL >= MSG_TRANSFER
|
#if DEBUG_LEVEL >= MSG_TRANSFER
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#define DEBUG_TRANS(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_TRANS : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
#define DEBUG_TRANS(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_TRANS : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||||
@@ -118,6 +121,7 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
#define DEBUG_TRANS(fmt, args...)
|
#define DEBUG_TRANS(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG_LEVEL >= MSG_EXTRA
|
#if DEBUG_LEVEL >= MSG_EXTRA
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#define DEBUG_EXTRA(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_EXTRA : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
#define DEBUG_EXTRA(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_EXTRA : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||||
@@ -127,6 +131,16 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
#define DEBUG_EXTRA(fmt, args...)
|
#define DEBUG_EXTRA(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL >= MSG_FLOW
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
#define DEBUG_FLOW(fmt, args...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "ZT_FLOW : %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args))
|
||||||
|
#else
|
||||||
|
#define DEBUG_FLOW(fmt, args...) fprintf(stderr, "ZT_FLOW: %14s:%4d:%25s: " fmt "\n", __FILENAME__, __LINE__, __FUNCTION__, ##args)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DEBUG_FLOW(fmt, args...)
|
||||||
|
#endif
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Reference in New Issue
Block a user