fix typo in resource_adc_mcp3008.c
[apps/native/position-finder-server.git] / inc / log.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Contact: Jin Yoon <jinny.yoon@samsung.com>
5  *          Geunsun Lee <gs86.lee@samsung.com>
6  *          Eunyoung Lee <ey928.lee@samsung.com>
7  *          Junkyu Han <junkyu.han@samsung.com>
8  *
9  * Licensed under the Flora License, Version 1.1 (the License);
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://floralicense.org/license/
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an AS IS BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21
22 #ifndef __POSITION_FINDER_SERVER_H__
23 #define __POSITION_FINDER_SERVER_H__
24
25 #include <dlog.h>
26
27 #ifdef  LOG_TAG
28 #undef  LOG_TAG
29 #endif
30 #define LOG_TAG "POSITION_FINDER_SERVER"
31
32 #if !defined(_D)
33 #define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
34 #endif
35
36 #if !defined(_I)
37 #define _I(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
38 #endif
39
40 #if !defined(_W)
41 #define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
42 #endif
43
44 #if !defined(_E)
45 #define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
46 #endif
47
48 #define retvm_if(expr, val, fmt, arg...) do { \
49         if (expr) { \
50                 _E(fmt, ##arg); \
51                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
52                 return val; \
53         } \
54 } while (0)
55
56 #define retv_if(expr, val) do { \
57         if (expr) { \
58                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
59                 return (val); \
60         } \
61 } while (0)
62
63 #define retm_if(expr, fmt, arg...) do { \
64         if (expr) { \
65                 _E(fmt, ##arg); \
66                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
67                 return; \
68         } \
69 } while (0)
70
71 #define ret_if(expr) do { \
72         if (expr) { \
73                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
74                 return; \
75         } \
76 } while (0)
77
78 #define goto_if(expr, val) do { \
79         if (expr) { \
80                 _E("(%s) -> goto", #expr); \
81                 goto val; \
82         } \
83 } while (0)
84
85 #define break_if(expr) { \
86         if (expr) { \
87                 _E("(%s) -> break", #expr); \
88                 break; \
89         } \
90 }
91
92 #define continue_if(expr) { \
93         if (expr) { \
94                 _E("(%s) -> continue", #expr); \
95                 continue; \
96         } \
97 }
98
99
100
101 #endif /* __POSITION_FINDER_SERVER_H__ */