tizen 2.3.1 release
[apps/home/settings.git] / setting-syspopup / include / debug.h
1 /*
2  * mode-syspopup, debug
3  *
4  * Copyright 2012  Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.tizenopensource.org/license
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _DEBUG_H_
21 #define _DEBUG_H_
22
23 #include <dlog.h>
24
25 #if !defined(PACKAGE)
26 #define PACKAGE "mode-syspopup"
27 #endif
28
29 #if !defined(LOCALEDIR)
30 #define LOCALEDIR "/usr/apps/org.tizen.mode-syspopup/res/locale"
31 #endif
32
33 #ifdef LOG_TAG
34 #undef LOG_TAG
35 #endif
36
37 #ifndef retv_if
38 #define retv_if(expr, val) do { \
39                 if(expr) { \
40                         return (val); \
41                 } \
42         } while (0)
43 #endif
44 #ifndef ret_if
45 #define ret_if(expr) do { \
46                 if(expr) { \
47                         return ; \
48                 } \
49         } while (0)
50 #endif
51 #ifndef retm_if
52 #define retm_if(expr, fmt, arg...) do { \
53         if(expr) { \
54                 _DBG(fmt, ##arg); \
55                 return; \
56         } \
57 } while (0);
58 #endif
59 #ifndef retvm_if
60 #define retvm_if(expr, val, fmt, arg...) do { \
61         if(expr) { \
62                 _DBG(fmt, ##arg); \
63                 return(val); \
64         } \
65 } while (0);
66 #endif
67
68 #define LOG_TAG "MODE_SYSPOPUP"
69
70 #define ENABLE_LOG
71
72 #ifdef ENABLE_LOG
73 #define _DBG(fmt, arg...) LOGD(fmt, ##arg)
74 #define _INFO(fmt, arg...) LOGI(fmt, ##arg)
75 #define _ERR(fmt, arg...) LOGE(fmt, ##arg)
76 #else
77 #define _DBG(fmt, arg...)
78 #define _INFO(fmt, arg...)
79 #define _ERR(fmt, arg...)
80 #endif
81
82 #define goto_if(expr, val) do { \
83                 if(expr) { \
84                         _ERR("(%s) -> goto", #expr); \
85                         goto val; \
86                 } \
87         } while (0)
88
89 #ifdef _
90 #undef _
91 #endif
92
93 #endif /*_DEBUG_H_ */