Modify the log message
[apps/native/ug-nfc-efl.git] / ug-nfc-share-efl / include / ug-nfc-share-common-debug.h
1 /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
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
7
8   *     http://www.tizenopensource.org/license
9   *
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.
15   */
16
17
18 #ifndef __UG_NFC_SHARE_DEBUG_H__
19 #define __UG_NFC_SHARE_DEBUG_H__
20
21 #define COLOR_RED               "\033[0;31m"
22 #define COLOR_GREEN     "\033[0;32m"
23 #define COLOR_BROWN     "\033[0;33m"
24 #define COLOR_BLUE              "\033[0;34m"
25 #define COLOR_PURPLE    "\033[0;35m"
26 #define COLOR_CYAN              "\033[0;36m"
27 #define COLOR_LIGHTBLUE "\033[0;37m"
28 #define COLOR_END               "\033[0;m"
29
30 #ifdef LOG_TAG
31 #undef LOG_TAG
32 #endif
33
34 #define LOG_TAG "UG_SHARE_NFC_EFL"
35
36 #define UG_NFC_SHARE_ENABLE_DLOG
37
38 #ifdef UG_NFC_SHARE_ENABLE_DLOG
39 #define UG_NFC_SHARE_DEBUG(fmt, ...)\
40         do\
41         {\
42                 LOGD(fmt,##__VA_ARGS__);\
43         } while (0)
44
45 #define UG_NFC_SHARE_DEBUG_ERR(fmt, ...)\
46         do\
47         {\
48                 LOGE(COLOR_RED fmt COLOR_END,##__VA_ARGS__);\
49         }while (0)
50
51 #define UG_NFC_SHARE_BEGIN() \
52         do\
53     {\
54                 LOGD(COLOR_BLUE"BEGIN >>>>"COLOR_END);\
55     } while( 0 )
56
57 #define UG_NFC_SHARE_END() \
58         do\
59     {\
60                 LOGD(COLOR_BLUE"END <<<<"COLOR_END);\
61     } \
62     while( 0 )
63
64 #else
65 #define UG_NFC_SHARE_DEBUG(fmt, ...) \
66         do\
67         {\
68                 printf("\n [%s: %s: %s(): %d] " fmt"\n",  APPNAME, rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
69         } while (0)
70
71 #define UG_NFC_SHARE_BEGIN() \
72         do\
73     {\
74         printf("\n [%s: %s: %d] : BEGIN >>>> %s() \n", APPNAME, rindex(__FILE__, '/')+1,  __LINE__ , __FUNCTION__);\
75     } while( 0 )
76
77 #define UG_NFC_SHARE_END() \
78         do\
79     {\
80         printf("\n [%s: %s: %d]: END   <<<< %s()\n", APPNAME, rindex(__FILE__, '/')+1,  __LINE__ , __FUNCTION__); \
81     } \
82     while( 0 )
83 #endif
84
85
86 #define ret_if(expr) do { \
87         if(expr) { \
88                 UG_NFC_SHARE_DEBUG_ERR("(%s) ", #expr); \
89                 UG_NFC_SHARE_END();\
90                 return; \
91         } \
92 } while (0)
93 #define retm_if(expr, fmt, arg...) do { \
94          if(expr) { \
95                  UG_NFC_SHARE_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
96                  UG_NFC_SHARE_END();\
97                  return; \
98          } \
99  } while (0)
100 #define retv_if(expr, val) do { \
101                 if(expr) { \
102                         UG_NFC_SHARE_DEBUG_ERR("(%s) ", #expr); \
103                         UG_NFC_SHARE_END();\
104                         return (val); \
105                 } \
106         } while (0)
107 #define retvm_if(expr, val, fmt, arg...) do { \
108         if(expr) { \
109                 UG_NFC_SHARE_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
110                 UG_NFC_SHARE_END();\
111                 return (val); \
112         } \
113 } while (0)
114
115
116 #endif /*__UG_NFC_SHARE_DEBUG_H__*/
117