2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 /**********************************************************************
24 ******************define, struct ,typedef, union, enum, global val *************************************
25 ***********************************************************************/
26 #define DB_FUN_BEG() DB_INFO("====>>>>fun=%s, BEGIN====>>>>", __FUNCTION__);
27 #define DB_FUN_END() DB_INFO("====>>>>fun=%s, END====>>>>", __FUNCTION__);
28 #define DB_INFO(fmt, arg...) LOGD("[%s:%d] "fmt, __FILE__, __LINE__, ##arg);
29 #define DB_ERR(fmt, arg...) LOGE(FONT_COLOR_RED"[%s:%d] "fmt FONT_COLOR_RESET, __FILE__, __LINE__, ##arg);
31 #define DB_FUN_DEBUG_BEG() //DB_INFO("====>>>>fun=%s, BEGIN====>>>>",__FUNCTION__);
32 #define DB_FUN_DEBUG_END() //DB_INFO("====>>>>fun=%s, END====>>>>", __FUNCTION__);
33 #define DB_DEBUG_INFO(fmt, arg...) //DB_INFO(fmt, ##arg)
34 #define DB_DEBUG_INFO(fmt, arg...) //DB_ERR(fmt,##arg)
36 #define DB_RET_IF(expr) \
40 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
45 #define DB_RETV_IF(expr, val) \
50 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
54 #define DB_RETE_IF(expr, errorId) \
58 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
62 #define DB_RETEM_IF(expr, errorId, fmt, arg...) \
66 DB_INFO_RED(fmt, ##arg); \
67 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
71 #define DB_RETVE_IF(expr, val, errorId) \
76 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
80 #define DB_RETM_IF(expr, fmt, arg...) \
84 DB_INFO_RED(fmt, ##arg); \
85 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
89 #define DB_RETVM_IF(expr, val, fmt, arg...) \
94 DB_INFO_RED(fmt, ##arg); \
95 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
99 #define DB_RETVME_IF(expr, val, errorId, fmt, arg...) \
104 DB_INFO_RED(fmt, ##arg); \
105 DB_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
109 /* anci c color type */
110 #define FONT_COLOR_RESET "\033[0m"
111 #define FONT_COLOR_RED "\033[31m"
112 #define FONT_COLOR_GREEN "\033[32m"
113 #define FONT_COLOR_YELLOW "\033[33m"
114 #define FONT_COLOR_BLUE "\033[34m"
115 #define FONT_COLOR_PURPLE "\033[35m"
116 #define FONT_COLOR_CYAN "\033[36m"
117 #define FONT_COLOR_GRAY "\033[37m"
119 #define DB_INFO_RED(fmt, arg...) DB_INFO(FONT_COLOR_RED fmt FONT_COLOR_RESET, ##arg)
120 #define DB_INFO_GREEN(fmt, arg...) DB_INFO(FONT_COLOR_GREEN fmt FONT_COLOR_RESET, ##arg)
121 #define DB_INFO_YELLOW(fmt, arg...) DB_INFO(FONT_COLOR_YELLOW fmt FONT_COLOR_RESET, ##arg)
122 #define DB_INFO_BLUE(fmt, arg...) DB_INFO(FONT_COLOR_BLUE fmt FONT_COLOR_RESET, ##arg)
123 #define DB_INFO_PURPLE(fmt, arg...) DB_INFO(FONT_COLOR_PURPLE fmt FONT_COLOR_RESET, ##arg)
124 #define DB_INFO_GREEN(fmt, arg...) DB_INFO(FONT_COLOR_GREEN fmt FONT_COLOR_RESET, ##arg)
125 #define DB_INFO_CYAN(fmt, arg...) DB_INFO(FONT_COLOR_CYAN fmt FONT_COLOR_RESET, ##arg)
126 #define DB_INFO_GRAY(fmt, arg...) DB_INFO(FONT_COLOR_GRAY fmt FONT_COLOR_RESET, ##arg)
128 #define DB_INFO_WITH_COLOR(color, fmt, arg...) DB_INFO(color fmt FONT_COLOR_RESET, ##arg)
131 #define warn_if(expr, fmt, arg...) do { \
133 DB_INFO("(%s) -> "fmt, #expr, ##arg); \
136 #define ret_if(expr) do { \
138 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
142 #define retv_if(expr, val) do { \
144 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
148 #define retm_if(expr, fmt, arg...) do { \
150 DB_ERR(fmt, ##arg); \
151 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
155 #define retvm_if(expr, val, fmt, arg...) do { \
157 DB_ERR(fmt, ##arg); \
158 DB_ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
162 #endif //__DB_DLOG_H__