3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
24 /**********************************************************************
25 ******************define, struct ,typedef, union, enum, global val *************************************
26 ***********************************************************************/
27 #define DB_FUN_BEG() DB_INFO("====>>>>fun=%s, BEGIN====>>>>", __FUNCTION__);
28 #define DB_FUN_END() DB_INFO("====>>>>fun=%s, END====>>>>", __FUNCTION__);
29 #define DB_INFO(fmt, arg...) LOGD("[%s:%d] "fmt, __FILE__, __LINE__, ##arg);
30 #define DB_ERR(fmt, arg...) LOGE(FONT_COLOR_RED"[%s:%d] "fmt FONT_COLOR_RESET, __FILE__, __LINE__, ##arg);
32 #define DB_FUN_DEBUG_BEG() //DB_INFO("====>>>>fun=%s, BEGIN====>>>>",__FUNCTION__);
33 #define DB_FUN_DEBUG_END() //DB_INFO("====>>>>fun=%s, END====>>>>", __FUNCTION__);
34 #define DB_DEBUG_INFO(fmt, arg...) //DB_INFO(fmt, ##arg)
35 #define DB_DEBUG_INFO(fmt, arg...) //DB_ERR(fmt,##arg)
37 #define DB_RET_IF(expr) \
41 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
46 #define DB_RETV_IF(expr, val) \
51 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
55 #define DB_RETE_IF(expr, errorId) \
59 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
63 #define DB_RETEM_IF(expr, errorId, fmt, arg...) \
67 DB_INFO_RED(fmt, ##arg); \
68 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
72 #define DB_RETVE_IF(expr, val, errorId) \
77 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
81 #define DB_RETM_IF(expr, fmt, arg...) \
85 DB_INFO_RED(fmt, ##arg); \
86 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
90 #define DB_RETVM_IF(expr, val, fmt, arg...) \
95 DB_INFO_RED(fmt, ##arg); \
96 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
100 #define DB_RETVME_IF(expr, val, errorId, fmt, arg...) \
105 DB_INFO_RED(fmt, ##arg); \
106 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
110 /* anci c color type */
111 #define FONT_COLOR_RESET "\033[0m"
112 #define FONT_COLOR_RED "\033[31m"
113 #define FONT_COLOR_GREEN "\033[32m"
114 #define FONT_COLOR_YELLOW "\033[33m"
115 #define FONT_COLOR_BLUE "\033[34m"
116 #define FONT_COLOR_PURPLE "\033[35m"
117 #define FONT_COLOR_CYAN "\033[36m"
118 #define FONT_COLOR_GRAY "\033[37m"
120 #define DB_INFO_RED(fmt, arg...) DB_INFO(FONT_COLOR_RED fmt FONT_COLOR_RESET, ##arg)
121 #define DB_INFO_GREEN(fmt, arg...) DB_INFO(FONT_COLOR_GREEN fmt FONT_COLOR_RESET, ##arg)
122 #define DB_INFO_YELLOW(fmt, arg...) DB_INFO(FONT_COLOR_YELLOW fmt FONT_COLOR_RESET, ##arg)
123 #define DB_INFO_BLUE(fmt, arg...) DB_INFO(FONT_COLOR_BLUE fmt FONT_COLOR_RESET, ##arg)
124 #define DB_INFO_PURPLE(fmt, arg...) DB_INFO(FONT_COLOR_PURPLE fmt FONT_COLOR_RESET, ##arg)
125 #define DB_INFO_GREEN(fmt, arg...) DB_INFO(FONT_COLOR_GREEN fmt FONT_COLOR_RESET, ##arg)
126 #define DB_INFO_CYAN(fmt, arg...) DB_INFO(FONT_COLOR_CYAN fmt FONT_COLOR_RESET, ##arg)
127 #define DB_INFO_GRAY(fmt, arg...) DB_INFO(FONT_COLOR_GRAY fmt FONT_COLOR_RESET, ##arg)
129 #define DB_INFO_WITH_COLOR(color, fmt, arg...) DB_INFO(color fmt FONT_COLOR_RESET, ##arg)
132 #define warn_if(expr, fmt, arg...) do { \
134 DB_INFO("(%s) -> "fmt, #expr, ##arg); \
137 #define ret_if(expr) do { \
139 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
143 #define retv_if(expr, val) do { \
145 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
149 #define retm_if(expr, fmt, arg...) do { \
151 DB_ERR(fmt, ##arg); \
152 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
156 #define retvm_if(expr, val, fmt, arg...) do { \
158 DB_ERR(fmt, ##arg); \
159 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
163 #endif //__DB_DLOG_H__