Tizen 2.4.0 rev3 SDK Public Release
[apps/home/attach-panel.git] / include / log.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 #ifndef __ATTACH_PANEL_LOG_H__
18 #define __ATTACH_PANEL_LOG_H__
19
20 #include <dlog.h>
21
22 #undef LOG_TAG
23 #define LOG_TAG "ATTACH_PANEL"
24
25 #if defined(D_)
26 #undef D_
27 #endif
28 #define D_(str) dgettext(PACKAGE, str)
29
30 #if !defined(_D)
31 #define _D(fmt, arg...) LOGD(fmt"\n", ##arg)
32 #endif
33
34 #if !defined(_W)
35 #define _W(fmt, arg...) LOGW(fmt"\n", ##arg)
36 #endif
37
38 #if !defined(_E)
39 #define _E(fmt, arg...) LOGE(fmt"\n", ##arg)
40 #endif
41
42 #if !defined(_SD)
43 #define _SD(fmt, arg...) SECURE_LOGD(fmt"\n", ##arg)
44 #endif
45
46 #if !defined(_SW)
47 #define _SW(fmt, arg...) SECURE_LOGW(fmt"\n", ##arg)
48 #endif
49
50 #if !defined(_SE)
51 #define _SE(fmt, arg...) SECURE_LOGE(fmt"\n", ##arg)
52 #endif
53
54 #define retv_if(expr, val) do { \
55         if(expr) { \
56                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
57                 return (val); \
58         } \
59 } while (0)
60
61 #define ret_if(expr) do { \
62         if(expr) { \
63                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
64                 return; \
65         } \
66 } while (0)
67
68 #define goto_if(expr, val) do { \
69         if(expr) { \
70                 _E("(%s) -> goto", #expr); \
71                 goto val; \
72         } \
73 } while (0)
74
75 #define break_if(expr) { \
76         if(expr) { \
77                 _E("(%s) -> break", #expr); \
78                 break; \
79         } \
80 }
81
82 #define continue_if(expr) { \
83         if(expr) { \
84                 _E("(%s) -> continue", #expr); \
85                 continue; \
86         } \
87 }
88
89 #endif /* __ATTACH_PANEL_LOG_H__ */