X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Ftdm_log.h;h=f1b3cdc0dfd2f338b673c882ed4bfe83fd68a1a7;hb=2adc0c96b4af5f88b3560e8ebd0b595a3f483578;hp=d402a99900c04323e5ecd86255799921d1be48b4;hpb=306c587fec093501cd537c72eb22096aa5ea37a5;p=platform%2Fcore%2Fuifw%2Flibtdm.git diff --git a/include/tdm_log.h b/include/tdm_log.h index d402a99..f1b3cdc 100644 --- a/include/tdm_log.h +++ b/include/tdm_log.h @@ -9,7 +9,7 @@ * Taeheon Kim , * YoungJun Cho , * SooChan Lim , - * Boram Park + * Boram Park * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -66,43 +66,66 @@ enum { void tdm_log_enable_color(unsigned int enable); void tdm_log_enable_dlog(unsigned int enable); -void tdm_log_enable_debug(unsigned int enable); void tdm_log_set_debug_level(int level); +void tdm_log_set_assert_level(int level); +void tdm_log_set_path(const char *path); +void tdm_log_printf(int level, const char *fmt, ...); void tdm_log_print(int level, const char *fmt, ...); +void tdm_log_reset(void); + +extern unsigned int tdm_log_debug_level; + #define TDM_DBG(fmt, args...) \ do { \ - struct timespec ts; \ - clock_gettime(CLOCK_MONOTONIC, &ts); \ - tdm_log_print(TDM_LOG_LEVEL_DBG, "[%5d.%06d][%d][%s %d]"fmt"\n", \ - (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ - (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + if (tdm_log_debug_level >= TDM_LOG_LEVEL_DBG) { \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + tdm_log_print(TDM_LOG_LEVEL_DBG, "[%5d.%06d][%d][%s %d]"fmt, \ + (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ + (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + } \ } while (0) #define TDM_INFO(fmt, args...) \ do { \ - struct timespec ts; \ - clock_gettime(CLOCK_MONOTONIC, &ts); \ - tdm_log_print(TDM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d]"fmt"\n", \ - (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ - (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + if (tdm_log_debug_level >= TDM_LOG_LEVEL_INFO) { \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + tdm_log_print(TDM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d]"fmt, \ + (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ + (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + } \ } while (0) #define TDM_WRN(fmt, args...) \ do { \ - struct timespec ts; \ - clock_gettime(CLOCK_MONOTONIC, &ts); \ - tdm_log_print(TDM_LOG_LEVEL_WRN, "[%5d.%06d][%d][%s %d]"fmt"\n", \ - (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ - (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + if (tdm_log_debug_level >= TDM_LOG_LEVEL_WRN) { \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + tdm_log_print(TDM_LOG_LEVEL_WRN, "[%5d.%06d][%d][%s %d]"fmt, \ + (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ + (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + } \ } while (0) #define TDM_ERR(fmt, args...) \ do { \ - struct timespec ts; \ - clock_gettime(CLOCK_MONOTONIC, &ts); \ - tdm_log_print(TDM_LOG_LEVEL_ERR, "[%5d.%06d][%d][%s %d]"fmt"\n", \ - (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ - (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + if (tdm_log_debug_level >= TDM_LOG_LEVEL_ERR) { \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + tdm_log_print(TDM_LOG_LEVEL_ERR, "[%5d.%06d][%d][%s %d]"fmt, \ + (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ + (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ + } \ } while (0) +#define TDM_NEVER_GET_HERE() TDM_WRN("** NEVER GET HERE **") +#define TDM_DEPRECATED(str) \ + do { \ + if (str) \ + TDM_WRN("** DEPRECATED: %s **", str); \ + else \ + TDM_WRN("** DEPRECATED **"); \ + } while(0) + #ifdef __cplusplus } #endif