Initialize Tizen 2.3
[apps/home/ug-nfc-efl.git] / ug-nfc-share-efl / include / ug-nfc-share-common-debug.h
1 /*
2   * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3   *
4   * Licensed under the Flora License, Version 1.1 (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://floralicense.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                 LOGD(COLOR_BROWN" " fmt COLOR_END,##__VA_ARGS__);\
42         } while (0)
43 #define UG_NFC_SHARE_DEBUG_ERR(fmt, ...)\
44         do { \
45                 LOGE(COLOR_RED" " fmt COLOR_END,##__VA_ARGS__);\
46         } while (0)
47 #define UG_NFC_SHARE_BEGIN() \
48         do { \
49                 LOGD(COLOR_BLUE"BEGIN >>>>"COLOR_END);\
50         } while (0)
51 #define UG_NFC_SHARE_END() \
52         do { \
53                 LOGD(COLOR_BLUE"END <<<<"COLOR_END);\
54         } while (0)
55 #else
56 #define UG_NFC_SHARE_DEBUG(fmt, ...) \
57         do { \
58                 printf("\n [%s: %s: %s(): %d] " fmt"\n",  APPNAME, rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
59         } while (0)
60 #define UG_NFC_SHARE_BEGIN() \
61         do { \
62                 printf("\n [%s: %s: %d] : BEGIN >>>> %s() \n", APPNAME, rindex(__FILE__, '/')+1,  __LINE__ , __FUNCTION__);\
63         } while (0)
64 #define UG_NFC_SHARE_END() \
65         do { \
66                 printf("\n [%s: %s: %d]: END   <<<< %s()\n", APPNAME, rindex(__FILE__, '/')+1,  __LINE__ , __FUNCTION__); \
67         } while (0)
68 #endif
69
70 #define ret_if(expr) \
71         do { \
72                 if(expr) { \
73                         UG_NFC_SHARE_DEBUG_ERR("(%s) ", #expr); \
74                         UG_NFC_SHARE_END();\
75                         return; \
76                 } \
77         } while (0)
78 #define retm_if(expr, fmt, arg...) \
79         do { \
80                 if(expr) { \
81                         UG_NFC_SHARE_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
82                         UG_NFC_SHARE_END();\
83                         return; \
84                 } \
85         } while (0)
86 #define retv_if(expr, val) \
87         do { \
88                 if(expr) { \
89                         UG_NFC_SHARE_DEBUG_ERR("(%s) ", #expr); \
90                         UG_NFC_SHARE_END();\
91                         return (val); \
92                 } \
93         } while (0)
94 #define retvm_if(expr, val, fmt, arg...) \
95         do { \
96                 if(expr) { \
97                         UG_NFC_SHARE_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
98                         UG_NFC_SHARE_END();\
99                         return (val); \
100                 } \
101         } while (0)
102
103 #endif /*__UG_NFC_SHARE_DEBUG_H__*/
104