tizen 2.3 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
52 #define LOG_TAG "MODE_SYSPOPUP"
53
54 #define ENABLE_LOG
55
56 #ifdef ENABLE_LOG
57 #define _DBG(fmt, arg...) LOGD(fmt, ##arg)
58 #define _INFO(fmt, arg...) LOGI(fmt, ##arg)
59 #define _ERR(fmt, arg...) LOGE(fmt, ##arg)
60 #else
61 #define _DBG(fmt, arg...)
62 #define _INFO(fmt, arg...)
63 #define _ERR(fmt, arg...)
64 #endif
65
66 #define goto_if(expr, val) do { \
67         if(expr) { \
68                 _ERR("(%s) -> goto", #expr); \
69                 goto val; \
70         } \
71 } while (0)
72
73 #ifdef _
74 #undef _
75 #endif
76
77 #endif //_DEBUG_H_