X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fhmi-debug.h;fp=include%2Fhmi-debug.h;h=282386c671e36f299510e4d2c38bcf894338228c;hb=5ac52dc6412f8311b6cfbd0e99652c914d5c6168;hp=2bd3478f3dbea7afeb774f8b3f3f952f4ac73312;hpb=973a7123c0bced7c7e7d9dc6dc5e990a0e2838ac;p=apps%2Fagl-service-windowmanager.git 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