Modify the package version
[apps/native/ug-bluetooth-efl.git] / include / bt-debug.h
1 /*
2 * ug-bluetooth-efl
3 *
4 * Copyright 2012 Samsung Electronics Co., Ltd
5 *
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 *           GirishAshok Joshi <girish.joshi@samsung.com>
8 *           DoHyun Pyun <dh79.pyun@samsung.com>
9 *
10 * Licensed under the Flora License, Version 1.1 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.tizenopensource.org/license
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 */
23
24 #ifndef __BT_DEBUG_H
25 #define __BT_DEBUG_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <dlog.h>
32 #include <stdio.h>
33 #include <string.h>
34
35 #undef LOG_TAG
36 #define LOG_TAG "BLUETOOTH_SETTING_UG"
37
38 #define BT_INFO(fmt, arg...) SLOGI(fmt, ##arg)
39
40 #define BT_ERR(fmt, arg...) SLOGE(fmt, ##arg)
41
42 #define BT_DBG(fmt, arg...) SLOGD(fmt, ##arg)
43
44
45 #define DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args)
46 #define ERR_SECURE(fmt, args...) SECURE_SLOGE(fmt, ##args)
47 #define INFO_SECURE(fmt, args...) SECURE_SLOGI(fmt, ##args)
48
49 #define FUNCTION_TRACE
50 #ifdef FUNCTION_TRACE
51 #define FN_START BT_DBG("[ENTER FUNC]");
52 #define FN_END BT_DBG("[EXIT FUNC]");
53 #else
54 #define FN_START
55 #define FN_END
56 #endif
57
58 #define warn_if(expr, fmt, arg...) \
59         do { \
60                 if (expr) { \
61                         BT_ERR("(%s) -> "fmt, #expr, ##arg); \
62                 } \
63         } while (0);
64
65 #define ret_if(expr) \
66         do { \
67                 if (expr) { \
68                         BT_ERR("(%s) return", #expr); \
69                         return; \
70                 } \
71         } while (0);
72
73 #define retv_if(expr, val) \
74         do { \
75                 if (expr) { \
76                         BT_ERR("(%s) return", #expr); \
77                         return (val); \
78                 } \
79         } while (0);
80
81 #define retm_if(expr, fmt, arg...) \
82         do { \
83                 if (expr) { \
84                         BT_ERR(fmt, ##arg); \
85                         BT_ERR("(%s) return", #expr); \
86                         return; \
87                 } \
88         } while (0);
89
90 #define retvm_if(expr, val, fmt, arg...) \
91         do { \
92                 if (expr) { \
93                         BT_ERR(fmt, ##arg); \
94                         BT_ERR("(%s) return", #expr); \
95                         return (val); \
96                 } \
97         } while (0);
98
99 #ifdef __cplusplus
100 }
101 #endif
102 #endif                          /* __BT_DEBUG_H */