Revert "ttab: Set TARGET_NEEDS_NETD_DIRECT_CONNECT_RULE to true"
[GitHub/mt8127/android_device_alcatel_ttab.git] / include / xlog.h
1 #if !defined(_XLOG_H)
2 #define _XLOG_H
3
4 #include <cutils/log.h>
5 #include <cutils/alelog.h>
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 int xlogf_java_tag_is_on(const char *name, int level);
12 int xlogf_native_tag_is_on(const char *name, int level);
13
14 int xlogf_java_xtag_is_on(const char *name, int level);
15 int xlogf_native_xtag_is_on(const char *name, int level);
16
17 #ifndef XLOG_TAG
18 #define XLOG_TAG NULL
19 #endif
20
21 #ifndef SXLOGV
22 #define SXLOGV(...) ((void)SXLOG_PRI(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
23 #endif
24 #ifndef SXLOGD
25 #define SXLOGD(...) ((void)SXLOG_PRI(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
26 #endif
27 #ifndef SXLOGI
28 #define SXLOGI(...) ((void)SXLOG_PRI(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
29 #endif
30 #ifndef SXLOGW
31 #define SXLOGW(...) ((void)SXLOG_PRI(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
32 #endif
33 #ifndef SXLOGE
34 #define SXLOGE(...) ((void)SXLOG_PRI(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
35 #endif
36 #ifndef SXLOGF
37 #define SXLOGF(...) ((void)SXLOG_PRI(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__))
38 #endif
39 #if LOG_NDEBUG
40 #define SXLOG_ASSERT(cond, ...) \
41 ( (CONDITION(cond)) \
42 ? ((void)SXLOGF(LOG_TAG, __VA_ARGS__)) \
43 : (void)0 )
44 #else
45 #define SXLOG_ASSERT(cond, ...) ((void)0)
46 #endif
47
48 #define SXLOG_ALWAYS_ASSERT(cond,...) \
49 ( (CONDITION(cond)) \
50 ? ((void)SXLOGF(LOG_TAG, __VA_ARGS__)) \
51 : (void)0 )
52
53 #ifndef XLOGV
54 #define XLOGV(...) ((void)XLOG_PRI(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
55 #endif
56 #ifndef XLOGD
57 #define XLOGD(...) ((void)XLOG_PRI(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
58 #endif
59 #ifndef XLOGI
60 #define XLOGI(...) ((void)XLOG_PRI(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
61 #endif
62 #ifndef XLOGW
63 #define XLOGW(...) ((void)XLOG_PRI(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
64 #endif
65 #ifndef XLOGE
66 #define XLOGE(...) ((void)XLOG_PRI(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
67 #endif
68 #ifndef XLOGF
69 #define XLOGF(...) ((void)XLOG_PRI(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__))
70 #endif
71
72 #if LOG_NDEBUG
73 #define XLOG_ASSERT(cond, ...) \
74 (!(cond) \
75 ? ((void)XLOGF(__VA_ARGS__)) \
76 : (void)0)
77 #else
78 #define XLOG_ASSERT(cond, ...) ((void)0)
79 #endif
80
81 #define XLOG_ALWAY_ASSERT(cond, ...) \
82 (!(cond) \
83 ? ((void)XLOGF(__VA_ARGS__)) \
84 : (void)0)
85
86
87 #ifndef SXLOGV2
88 #define SXLOGV2(...) ((void)SXLOG_PRI(ANDROID_LOG_VERBOSE, XLOG_TAG, __VA_ARGS__))
89 #endif
90 #ifndef SXLOGD2
91 #define SXLOGD2(...) ((void)SXLOG_PRI(ANDROID_LOG_DEBUG, XLOG_TAG, __VA_ARGS__))
92 #endif
93 #ifndef SXLOGI2
94 #define SXLOGI2(...) ((void)SXLOG_PRI(ANDROID_LOG_INFO, XLOG_TAG, __VA_ARGS__))
95 #endif
96 #ifndef SXLOGW2
97 #define SXLOGW2(...) ((void)SXLOG_PRI(ANDROID_LOG_WARN, XLOG_TAG, __VA_ARGS__))
98 #endif
99 #ifndef SXLOGE2
100 #define SXLOGE2(...) ((void)SXLOG_PRI(ANDROID_LOG_ERROR, XLOG_TAG, __VA_ARGS__))
101 #endif
102 #ifndef SXLOGF2
103 #define SXLOGF2(...) ((void)SXLOG_PRI(ANDROID_LOG_FATAL, XLOG_TAG, __VA_ARGS__))
104 #endif
105
106 #ifndef XLOGV2
107 #define XLOGV2(...) ((void)XLOG_PRI(ANDROID_LOG_VERBOSE, XLOG_TAG, __VA_ARGS__))
108 #endif
109 #ifndef XLOGD2
110 #define XLOGD2(...) ((void)XLOG_PRI(ANDROID_LOG_DEBUG, XLOG_TAG, __VA_ARGS__))
111 #endif
112 #ifndef XLOGI2
113 #define XLOGI2(...) ((void)XLOG_PRI(ANDROID_LOG_INFO, XLOG_TAG, __VA_ARGS__))
114 #endif
115 #ifndef XLOGW2
116 #define XLOGW2(...) ((void)XLOG_PRI(ANDROID_LOG_WARN, XLOG_TAG, __VA_ARGS__))
117 #endif
118 #ifndef XLOGE2
119 #define XLOGE2(...) ((void)XLOG_PRI(ANDROID_LOG_ERROR, XLOG_TAG, __VA_ARGS__))
120 #endif
121 #ifndef XLOGF2
122 #define XLOGF2(...) ((void)XLOG_PRI(ANDROID_LOG_FATAL, XLOG_TAG, __VA_ARGS__))
123 #endif
124
125 struct xlog_record {
126 const char *tag_str;
127 const char *fmt_str;
128 int prio;
129 };
130
131 #if defined(__cplusplus)
132 extern "C" {
133 #endif
134
135 int __xlog_buf_printf(int bufid, const struct xlog_record *rec, ...);
136
137 #if defined(__cplusplus)
138 }
139 #endif
140
141 #if !defined(HAVE_ALE_FEATURE)
142
143 #define xlog_buf_printf(bufid, prio, tag, fmt, ...) \
144 ({ \
145 static const struct xlog_record _xlog_rec = \
146 {tag, fmt, prio}; \
147 __xlog_buf_printf(bufid, &_xlog_rec, ##__VA_ARGS__); \
148 })
149
150 #else
151
152 #define xlog_buf_printf(bufid, prio, tag, fmt, ...) \
153 ({ \
154 static const struct ale_convert ____xlog_ale_rec____ = \
155 { tag, fmt, __FILE__, prio, 0, "" }; \
156 ale_log_output(bufid, prio, &____xlog_ale_rec____, \
157 ##__VA_ARGS__); \
158 })
159
160 #endif
161
162 #define XLOG_PRI(priority, tag, ...) \
163 xlog_buf_printf(LOG_ID_MAIN, priority, tag, __VA_ARGS__)
164
165 #define SXLOG_PRI(priority, tag, ...) \
166 xlog_buf_printf(LOG_ID_MAIN, priority, tag, __VA_ARGS__)
167
168 #define xlog_printf(priority, tag, ...) \
169 xlog_buf_printf(LOG_ID_MAIN, priority, tag, __VA_ARGS__)
170
171 #define sxlog_printf(priority, tag, ...) \
172 xlog_buf_printf(LOG_ID_SYSTEM, priority, tag, __VA_ARGS__)
173
174
175 #ifdef __cplusplus
176 }
177 #endif
178
179 #endif