d958e2eb127485762c34bd0c735d8d1b30c5d795
[apps/native/st-things-blind.git] / inc / log.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Contact: Jin Yoon <jinny.yoon@samsung.com>
5  *
6  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 #ifndef __POSITION_FINDER_SERVER_H__
20 #define __POSITION_FINDER_SERVER_H__
21
22 #include <dlog.h>
23
24 #ifdef  LOG_TAG
25 #undef  LOG_TAG
26 #endif
27 #define LOG_TAG "TT"
28
29 #if !defined(_D)
30 #define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
31 #endif
32
33 #if !defined(DBG)
34 #define DBG(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
35 #endif
36
37 #if !defined(_I)
38 #define _I(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
39 #endif
40
41 #if !defined(_W)
42 #define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
43 #endif
44
45 #if !defined(_E)
46 #define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
47 #endif
48
49 #define retvm_if(expr, val, fmt, arg...) do { \
50         if (expr) { \
51                 _E(fmt, ##arg); \
52                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
53                 return val; \
54         } \
55 } while (0)
56
57 #define retv_if(expr, val) do { \
58         if (expr) { \
59                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
60                 return (val); \
61         } \
62 } while (0)
63
64 #define retm_if(expr, fmt, arg...) do { \
65         if (expr) { \
66                 _E(fmt, ##arg); \
67                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
68                 return; \
69         } \
70 } while (0)
71
72 #define ret_if(expr) do { \
73         if (expr) { \
74                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
75                 return; \
76         } \
77 } while (0)
78
79 #define goto_if(expr, val) do { \
80         if (expr) { \
81                 _E("(%s) -> goto", #expr); \
82                 goto val; \
83         } \
84 } while (0)
85
86 #define break_if(expr) { \
87         if (expr) { \
88                 _E("(%s) -> break", #expr); \
89                 break; \
90         } \
91 }
92
93 #define continue_if(expr) { \
94         if (expr) { \
95                 _E("(%s) -> continue", #expr); \
96                 continue; \
97         } \
98 }
99
100
101
102 #endif /* __POSITION_FINDER_SERVER_H__ */