#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_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(fmt, args...) do { if (true) { \
- 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, 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)
+#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_COMMON_DBG_H_*/