/*
- * Media Server
+ * Media Server
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
*
*/
-/**
- * This file defines api utilities of contents manager engines.
- *
- * @file media-server-dbg.h
- * @author Yong Yeon Kim(yy9875.kim@samsung.com)
- * @version 1.0
- * @brief
- */
-
-#ifndef _MEDIA_SERVER_DBG_H_
-#define _MEDIA_SERVER_DBG_H_
+#ifndef _MEDIA_COMMON_DBG_H_
+#define _MEDIA_COMMON_DBG_H_
#include <sys/syscall.h>
#include <dlog.h>
#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,}; \
- strerror_r(errno, buf, BUF_LENGTH); \
- LOGE(fmt" : STANDARD ERROR [%s]", buf); \
+ LOGE(FONT_COLOR_RED""fmt""" : STANDARD ERROR [%s]"FONT_COLOR_RESET, strerror_r(errno, buf, BUF_LENGTH)); \
} while (0)
+#define MS_DBG_SLOG(fmt, arg...) do { if (true) { \
+ SECURE_LOGD(FONT_COLOR_CYAN""fmt""FONT_COLOR_RESET, ##arg); \
+ } } while (false)
+
+#define MS_DBG_SINFO(fmt, arg...) do { if (true) { \
+ SECURE_LOGI(FONT_COLOR_CYAN""fmt""FONT_COLOR_RESET, ##arg); \
+ } } while (false)
+
+#define MS_DBG_SWARN(fmt, arg...) do { if (true) { \
+ SECURE_LOGI(FONT_COLOR_CYAN""fmt""FONT_COLOR_RESET, ##arg); \
+ } } while (false)
-#define MS_DBG_SLOG(fmt, args...) SECURE_LOGD(fmt "\n", ##args);
+#define MS_DBG_SERR(fmt, arg...) do { if (true) { \
+ SECURE_LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
+ } } while (false)
-#define MS_DBG(fmt, args...) 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); \
- }} while(false)
+#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); \
- }} while(false)
+#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); \
- }} while(false)
+#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(FONT_COLOR_YELLOW"<ENTER>"FONT_COLOR_RESET); \
+ } } while (false)
+
+#define MS_DBG_FLEAVE() do { if (true) { \
+ LOGD(FONT_COLOR_YELLOW"<LEAVE>"FONT_COLOR_RESET); \
+ } } while (false)
+
+#define MS_DBG_RETV_IF(expr, val) do { \
+ if (expr) { \
+ LOGE(FONT_COLOR_RED""FONT_COLOR_RESET); \
+ return (val); \
+ } \
+ } while (0)
+
+#define MS_DBG_RETVM_IF(expr, val, fmt, arg...) do { \
+ if (expr) { \
+ LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
+ return (val); \
+ } \
+ } while (0)
-#endif /*_MEDIA_SERVER_DBG_H_*/
+#endif /*_MEDIA_COMMON_DBG_H_*/