Just change color of log 88/125588/1
authorHaejeong Kim <backto.kim@samsung.com>
Tue, 18 Apr 2017 05:10:08 +0000 (14:10 +0900)
committerHaejeong Kim <backto.kim@samsung.com>
Tue, 18 Apr 2017 05:10:08 +0000 (14:10 +0900)
Change-Id: I0df2f7d0418d4c4f207f3ee360a8b373e4959b0e

lib/include/media-util-dbg.h
src/common/include/media-common-dbg.h
src/server/media-server-main.c

index 8c5b66e..c578cb6 100755 (executable)
 
 #define MSAPI_DBG_STRERROR(fmt) do { \
                        char buf[BUF_LENGTH] = {0,}; \
-                       LOGE(fmt" : STANDARD ERROR [%s]", strerror_r(errno, buf, BUF_LENGTH));  \
+                       LOGE(FONT_COLOR_RED""fmt""" : STANDARD ERROR [%s]"FONT_COLOR_RESET, strerror_r(errno, buf, BUF_LENGTH)); \
                } while (0)
 
-#define MSAPI_DBG_SLOG(fmt, args...) do { \
-                       SECURE_LOGD(fmt "\n", ##args);     \
+#define MSAPI_DBG_SLOG(fmt, arg...) do { \
+                       SECURE_LOGD(FONT_COLOR_CYAN""fmt""FONT_COLOR_RESET, ##arg); \
                } while (0)
 
 #define MSAPI_DBG(fmt, arg...) do { \
-                       LOGD(FONT_COLOR_RESET fmt, ##arg);     \
+                       LOGD(FONT_COLOR_RESET""fmt"", ##arg); \
                } while (0)
 
 #define MSAPI_DBG_INFO(fmt, arg...) do { \
-                       LOGI(FONT_COLOR_GREEN fmt, ##arg);     \
+                       LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
                } while (0)
 
 #define MSAPI_DBG_ERR(fmt, arg...) do { \
-                       LOGE(FONT_COLOR_RED fmt, ##arg);     \
+                       LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
                } while (0)
 
 #define MSAPI_DBG_FUNC() do { \
 
 #define MSAPI_RETV_IF(expr, val) do { \
                        if (expr) { \
-                               LOGE(FONT_COLOR_RED);     \
+                               LOGE(FONT_COLOR_RED""FONT_COLOR_RESET);   \
                                return (val); \
                        } \
                } while (0)
 
 #define MSAPI_RETVM_IF(expr, val, fmt, arg...) do { \
                        if (expr) { \
-                               LOGE(FONT_COLOR_RED fmt, ##arg);        \
+                               LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
                                return (val); \
                        } \
                } while (0)
index 6f6c027..443e08e 100755 (executable)
 #define LOG_TAG "MEDIA_COMMON"
 #define BUF_LENGTH 256
 
+#define FONT_COLOR_RESET    "\033[0m"
+#define FONT_COLOR_RED      "\033[31m"
+#define FONT_COLOR_GREEN    "\033[32m"
+#define FONT_COLOR_YELLOW   "\033[33m"
+#define FONT_COLOR_BLUE     "\033[34m"
+#define FONT_COLOR_PURPLE   "\033[35m"
+#define FONT_COLOR_CYAN     "\033[36m"
+#define FONT_COLOR_GRAY     "\033[37m"
+
 #define MS_DBG_STRERROR(fmt) do { \
                        char buf[BUF_LENGTH] = {0,}; \
-                       LOGE(fmt" : STANDARD ERROR [%s]", strerror_r(errno, buf, BUF_LENGTH)); \
+                       LOGE(FONT_COLOR_RED""fmt""" : STANDARD ERROR [%s]"FONT_COLOR_RESET, strerror_r(errno, buf, BUF_LENGTH)); \
                } while (0)
 
-#define MS_DBG_SLOG(fmt, args...) do { if (true) { \
-               SECURE_LOGD(fmt "\n" , ##args); \
+#define MS_DBG_SLOG(fmt, arg...) do { if (true) { \
+               SECURE_LOGD(FONT_COLOR_CYAN""fmt""FONT_COLOR_RESET, ##arg); \
                } } while (false)
 
-#define MS_DBG(fmt, args...) do { if (true) { \
-               LOGD(fmt "\n" , ##args); \
+#define MS_DBG(fmt, arg...) do { if (true) { \
+               LOGD(FONT_COLOR_RESET""fmt"", ##arg); \
                } } while (false)
 
-#define MS_DBG_INFO(fmt, args...) do { if (true) { \
-               LOGI(fmt "\n" , ##args); \
+#define MS_DBG_INFO(fmt, arg...) do { if (true) { \
+               LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
                } } while (false)
 
-#define MS_DBG_WARN(fmt, args...) do { if (true) { \
-               LOGW(fmt "\n", ##args); \
+#define MS_DBG_WARN(fmt, arg...) do { if (true) { \
+               LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
                } } while (false)
 
-#define MS_DBG_ERR(fmt, args...) do { if (true) { \
-               LOGE(fmt "\n", ##args); \
+#define MS_DBG_ERR(fmt, arg...) do { if (true) { \
+               LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
                } } while (false)
 
 #define MS_DBG_FENTER() do { if (true) { \
-               LOGD("<ENTER> \n"); \
+               LOGD(FONT_COLOR_YELLOW"<ENTER>"FONT_COLOR_RESET); \
                } } while (false)
 
 #define MS_DBG_FLEAVE() do { if (true) { \
-               LOGD("<LEAVE> \n"); \
+               LOGD(FONT_COLOR_YELLOW"<LEAVE>"FONT_COLOR_RESET); \
                } } while (false)
 
 #endif /*_MEDIA_COMMON_DBG_H_*/
index 5057317..441c938 100755 (executable)
@@ -492,7 +492,9 @@ int main(int argc, char **argv)
        /*Active flush */
        malloc_trim(0);
 
+       MS_DBG_WARN("********************************");
        MS_DBG_WARN("*** Media Server is running ***");
+       MS_DBG_WARN("********************************");
 
        ms_write_media_server_status();