fix warning
[platform/core/appfw/appcore-widget.git] / src / widget-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
18 #ifndef __APPFW_WIDGET_LOG_H__
19 #define __APPFW_WIDGET_LOG_H__
20
21 #include <dlog.h>
22
23 #define _E(fmt, arg...) LOGE(fmt, ##arg)
24 #define _I(fmt, arg...) LOGI(fmt, ##arg)
25 #define _D(fmt, arg...) LOGD(fmt, ##arg)
26 #define _W(fmt, arg...) LOGW(fmt, ##arg)
27
28 #ifndef EXPORT_API
29 #define EXPORT_API __attribute__ ((visibility("default")))
30 #endif
31
32 #ifndef _E
33 #define _E(fmt, arg...) LOGE(fmt, ##arg)
34 #endif
35
36 #ifndef _I
37 #define _I(...) LOGI(__VA_ARGS__)
38 #endif
39
40 #ifndef _D
41 #define _D(...) LOGD(__VA_ARGS__)
42 #endif
43
44 #ifndef _W
45 #define _W(...) LOGW(__VA_ARGS__)
46 #endif
47
48 #define _warn_if(expr, fmt, arg...) do { \
49         if (expr) { \
50             _ERR(fmt, ##arg); \
51         } \
52     } while (0)
53
54 #define _ret_if(expr) do { \
55         if (expr) { \
56             return; \
57         } \
58     } while (0)
59
60 #define _retv_if(expr, val) do { \
61         if (expr) { \
62             return (val); \
63         } \
64     } while (0)
65
66 #define _retm_if(expr, fmt, arg...) do { \
67         if (expr) { \
68             _ERR(fmt, ##arg); \
69             return; \
70         } \
71     } while (0)
72
73 #define _retvm_if(expr, val, fmt, arg...) do { \
74         if (expr) { \
75             _ERR(fmt, ##arg); \
76             return (val); \
77         } \
78     } while (0)
79
80
81 #endif //__APPFW_WIDGET_LOG_H_