diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-05-25 11:17:55 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-05-25 11:30:01 +0900 |
commit | 5ac52dc6412f8311b6cfbd0e99652c914d5c6168 (patch) | |
tree | ed2b67670fff877f1fca852d982f512d6195c08a /include | |
parent | 973a7123c0bced7c7e7d9dc6dc5e990a0e2838ac (diff) |
[Local]:5th step for blocking sequence
Change-Id: Ic47c59a77d3b45f62bed8ee2617dddc4ed58afbe
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'include')
-rw-r--r-- | include/hmi-debug.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/hmi-debug.h b/include/hmi-debug.h index 2bd3478..282386c 100644 --- a/include/hmi-debug.h +++ b/include/hmi-debug.h @@ -47,6 +47,8 @@ enum LOG_LEVEL{ #define HMI_SEQ_INFO(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__) #define HMI_SEQ_DEBUG(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__) +#define DUMP(args, ...) _DUMP(LOG_LEVEL_DEBUG, args, ##__VA_ARGS__) + static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"}; static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...) @@ -95,4 +97,21 @@ static void _HMI_SEQ_LOG(enum LOG_LEVEL level, const char* file, const char* fun va_end(args); free(message); } + +static void _DUMP(enum LOG_LEVEL level, const char *log, ...) +{ + const int log_level = (getenv("USE_HMI_DEBUG") == NULL) ? LOG_LEVEL_ERROR : atoi(getenv("USE_HMI_DEBUG")); + if (log_level < level) + { + return; + } + char *message; + va_list args; + va_start(args, log); + if (log == NULL || vasprintf(&message, log, args) < 0) + message = NULL; + fprintf(stderr, "%s \n", message); + va_end(args); + free(message); +} #endif //__HMI_DEBUG_H__
\ No newline at end of file |