From 17e8e88216e7d10e064cef96836e87485777d66f Mon Sep 17 00:00:00 2001 From: Younho Park Date: Fri, 17 Jun 2016 13:55:12 +0900 Subject: [PATCH] [UTC][service-adaptor][Non-ACR][Fix for Build failed on SDK] Change-Id: I699f4d3f59774b63d057ee53b844d370ad7a2abe Signed-off-by: Younho Park --- src/utc/service-adaptor/log.h | 149 ++---------------------------------------- 1 file changed, 7 insertions(+), 142 deletions(-) mode change 100755 => 100644 src/utc/service-adaptor/log.h diff --git a/src/utc/service-adaptor/log.h b/src/utc/service-adaptor/log.h old mode 100755 new mode 100644 index 2979d8e..fb19ce8 --- a/src/utc/service-adaptor/log.h +++ b/src/utc/service-adaptor/log.h @@ -35,40 +35,13 @@ #include #include -/* These defines must be located before #include */ -#define TIZEN_ENGINEER_MODE -#ifndef TIZEN_DEBUG_ENABLE - #define TIZEN_DEBUG_ENABLE -#endif - #include #ifdef LOG_TAG #undef LOG_TAG #endif -#define LOG_TAG "SERVICE_ADAPTOR_CLIENT_UTC" - -/** - * Colors of font - */ -#define FONT_COLOR_RESET "\033[0m" -#define FONT_COLOR_BLACK "\033[30m" /* Black */ -#define FONT_COLOR_RED "\033[31m" /* Red */ -#define FONT_COLOR_GREEN "\033[32m" /* Green */ -#define FONT_COLOR_YELLOW "\033[33m" /* Yellow */ -#define FONT_COLOR_BLUE "\033[34m" /* Blue */ -#define FONT_COLOR_PURPLE "\033[35m" /* Purple */ -#define FONT_COLOR_CYAN "\033[36m" /* Cyan */ -#define FONT_COLOR_WHITE "\033[37m" /* White */ -#define FONT_COLOR_BOLDBLACK "\033[1m\033[30m" /* Bold Black */ -#define FONT_COLOR_BOLDRED "\033[1m\033[31m" /* Bold Red */ -#define FONT_COLOR_BOLDGREEN "\033[1m\033[32m" /* Bold Green */ -#define FONT_COLOR_BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */ -#define FONT_COLOR_BOLDBLUE "\033[1m\033[34m" /* Bold Blue */ -#define FONT_COLOR_BOLDPURPLE "\033[1m\033[35m" /* Bold Purple */ -#define FONT_COLOR_BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */ -#define FONT_COLOR_BOLDWHITE "\033[1m\033[37m" /* Bold White */ +#define LOG_TAG "SERVICE_ADAPTOR_UTC" /** * Gets thread ID @@ -76,45 +49,12 @@ #define log_gettid() syscall(__NR_gettid) /** - * @brief Macro for returning value if expression is satisfied - * @param[in] expr Expression to be checked - * @param[out] val Value to be returned when expression is true - */ -#define log_retv_if(expr, val) do { \ - if(expr) { \ - LOGE(FONT_COLOR_PURPLE"[%d]"FONT_COLOR_RESET, log_gettid()); \ - return (val); \ - } \ - } while (0) - -/** - * @brief Secured macro for returning value if expression is satisfied - * @param[in] expr Expression to be checked - * @param[out] val Value to be returned when expression is true - */ -#define slog_retv_if(expr, val) do { \ - if(expr) { \ - SLOGE(FONT_COLOR_PURPLE"[%d]"FONT_COLOR_RESET, log_gettid()); \ - return (val); \ - } \ - } while (0) - -/** * @brief Prints debug messages * @param[in] fmt Format of data to be displayed * @param[in] args Arguments to be displayed */ #define log_debug(fmt, arg...) do { \ - LOGD(FONT_COLOR_GREEN"[%d]"fmt""FONT_COLOR_RESET, log_gettid(), ##arg); \ - } while (0) - -/** - * @brief Prints secured debug messages - * @param[in] fmt Format of data to be displayed - * @param[in] args Arguments to be displayed - */ -#define slog_debug(fmt, arg...) do { \ - SLOGD(FONT_COLOR_GREEN"[%d]"fmt""FONT_COLOR_RESET, log_gettid(), ##arg); \ + dlog_print(DLOG_DEBUG, LOG_TAG, "[%d]"fmt"",log_gettid(), ##arg); \ } while (0) /** @@ -123,16 +63,7 @@ * @param[in] args Arguments to be displayed */ #define log_info(fmt, arg...) do { \ - LOGI(FONT_COLOR_BLUE"[%d]"fmt""FONT_COLOR_RESET, log_gettid() ,##arg); \ - } while (0) - -/** - * @brief Prints secured info messages - * @param[in] fmt Format of data to be displayed - * @param[in] args Arguments to be displayed - */ -#define slog_info(fmt, arg...) do { \ - SLOGI(FONT_COLOR_BLUE"[%d]"fmt""FONT_COLOR_RESET, log_gettid() ,##arg); \ + dlog_print(DLOG_INFO, LOG_TAG, "[%d]"fmt"",log_gettid(), ##arg); \ } while (0) /** @@ -141,16 +72,7 @@ * @param[in] args Arguments to be displayed */ #define log_warning(fmt, arg...) do { \ - LOGW(FONT_COLOR_YELLOW"[%d]"fmt""FONT_COLOR_RESET,log_gettid(), ##arg); \ - } while (0) - -/** - * @brief Prints secured warning messages - * @param[in] fmt Format of data to be displayed - * @param[in] args Arguments to be displayed - */ -#define slog_warning(fmt, arg...) do { \ - SLOGW(FONT_COLOR_YELLOW"[%d]"fmt""FONT_COLOR_RESET,log_gettid(), ##arg); \ + dlog_print(DLOG_WARNING, LOG_TAG, "[%d]"fmt"",log_gettid(), ##arg); \ } while (0) /** @@ -159,16 +81,7 @@ * @param[in] args Arguments to be displayed */ #define log_error(fmt, arg...) do { \ - LOGE(FONT_COLOR_RED"[%d]"fmt""FONT_COLOR_RESET,log_gettid(), ##arg); \ - } while (0) - -/** - * @brief Prints secured error messages - * @param[in] fmt Format of data to be displayed - * @param[in] args Arguments to be displayed - */ -#define slog_error(fmt, arg...) do { \ - SLOGE(FONT_COLOR_RED"[%d]"fmt""FONT_COLOR_RESET,log_gettid(), ##arg); \ + dlog_print(DLOG_ERROR, LOG_TAG, "[%d]"fmt"",log_gettid(), ##arg); \ } while (0) /** @@ -177,16 +90,7 @@ * @param[in] args Arguments to be displayed */ #define log_fatal(fmt, arg...) do { \ - LOGF(FONT_COLOR_BOLDRED"[%d]"fmt""FONT_COLOR_RESET,log_gettid(), ##arg); \ - } while (0) - -/** - * @brief Prints secured fatal messages - * @param[in] fmt Format of data to be displayed - * @param[in] args Arguments to be displayed - */ -#define slog_fatal(fmt, arg...) do { \ - SLOGF(FONT_COLOR_BOLDRED"[%d]"fmt""FONT_COLOR_RESET,log_gettid(), ##arg); \ + dlog_print(DLOG_FATAL, LOG_TAG, "[%d]"fmt"",log_gettid(), ##arg); \ } while (0) /** @@ -200,49 +104,10 @@ * @param[in] args Arguments to be displayed */ #define log_debug_func(fmt, arg...) do { \ - LOGD(FONT_COLOR_CYAN"[%d]"fmt""FONT_COLOR_RESET, log_get_thread_id(), ##arg); \ + dlog_print(DLOG_DEBUG, LOG_TAG, "[%d]"fmt"", log_get_thread_id(), ##arg); \ } while (0) #define startfunc log_debug_func("+- START -"); #define endfunc log_debug_func("+- END -"); -#define PERFORMANCE_START(marker) struct timeval marker = fs_utils_measure_start(); -#define PERFORMANCE_RESTART(marker) marker = fs_utils_measure_start(); -/** - * @brief Prints performance messages - * @param[in] fmt Format of data to be displayed - * @param[in] args Arguments to be displayed - */ -#define PERFORMANCE_LOG(marker, fmt, arg...) do { \ - LOGI(FONT_COLOR_BOLDYELLOW"[PERFORMANCE] [%d] - elapsed time: %llu msec for "fmt""FONT_COLOR_RESET, log_gettid(), fs_utils_measure_time(marker), ##arg); \ - } while (0); - -/** - * @brief Chomps newline and return control chars from given string - * @param[in] s String to be chomped - */ -#define chomp_eol(s) do { \ - char *temp = s; \ - while(*s && *s != '\n' && *s != '\r') s++; \ - *s = 0; \ - s = temp; \ - } while (0) - -/** - * @brief Prints debug time info for a particular file - * @param[in] file Name of file - * @param[in] added_time to display - * @param[in] modified_time to display - */ -#define log_debug_time(file, added_time, modified_time) do { \ - char *add_t = asctime(localtime(&added_time)); \ - char *mod_t = asctime(localtime(&modified_time)); \ - chomp_eol(add_t); \ - chomp_eol(mod_t); \ - log_info("File: %s, added_time = %s, modified_time = %s", \ - file, \ - add_t, \ - mod_t); \ - } while (0) - #endif /* __LOG_H__ */ -- 2.7.4