remove unneeded shims
[GitHub/mt8127/android_device_alcatel_ttab.git] / include / alelog.h
1 #if !defined(__ALE_H__)
2 #define __ALE_H__
3
4 #if defined(__cplusplus)
5 extern "C" {
6 #endif
7
8 #define LOGGER_ALE_MASK 0xf0
9
10 #define LOGGER_ALE_MSG_RAW 0x00
11 #define LOGGER_ALE_MSG_K 0x10
12 #define LOGGER_ALE_MSG_N 0x20
13 #define LOGGER_ALE_MSG_J 0x30
14 #define LOGGER_ALE_XMSG_K 0x40
15 #define LOGGER_ALE_XMSG_N 0x50
16 #define LOGGER_ALE_XMSG_J 0x60
17
18 #define LOGGER_ALE_MSG_SIZE 768
19
20 #define LOGGER_ALE_ARGS_MAX 16
21 struct ale_convert {
22 const char *tag_str;
23 const char *fmt_ptr;
24 const char *file;
25 int lineno;
26 unsigned int hash;
27 char params[LOGGER_ALE_ARGS_MAX];
28 };
29
30 int ale_log_output_binary(int prio, const char *tag, const void *payload, size_t len);
31
32 int ale_log_output(int bufid, int prio, const struct ale_convert *convert, ...);
33
34 #define ale_log_print(bufid, prio, tag, fmt, ...) \
35 ({ \
36 if (__builtin_constant_p(tag) && __builtin_constant_p(fmt)) { \
37 static const struct ale_convert ____ale_rec____ = \
38 { \
39 __builtin_constant_p(tag) ? tag : NULL, \
40 __builtin_constant_p(fmt) ? fmt : NULL, \
41 __FILE__, \
42 __builtin_constant_p(prio) ? prio : 0, \
43 0, \
44 "" }; \
45 ale_log_output(bufid, prio, &____ale_rec____, ##__VA_ARGS__); \
46 } \
47 else { \
48 struct ale_convert ale = \
49 {tag, fmt, NULL, \
50 0, 0, ""}; \
51 ale_log_output(bufid, prio, &ale, ##__VA_ARGS__); \
52 } \
53 })
54
55 #if defined(__cplusplus)
56 };
57 #endif
58
59 #endif