13#ifndef __xwos_lib_xwlog_h__
14#define __xwos_lib_xwlog_h__
18#if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
28int xwpf(
const char * fmt, ...);
31#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 0)
32# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
33# define XWLOGF_VERBOSE(tag, fmt, ...) xwpf("C%d|V|" tag " " fmt, \
34 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
35# define XWLOGF_V(tag, fmt, ...) xwpf("C%d|V|" tag " " fmt, \
36 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
38# define XWLOGF_VERBOSE(tag, fmt, ...) xwpf("V|" tag " " fmt, ##__VA_ARGS__)
39# define XWLOGF_V(tag, fmt, ...) xwpf("V|" tag " " fmt, ##__VA_ARGS__)
42# define XWLOGF_VERBOSE(tag, fmt, ...)
43# define XWLOGF_V(tag, fmt, ...)
46#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 1)
47# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
48# define XWLOGF_DEBUG(tag, fmt, ...) xwpf("C%d|D|" tag " " fmt, \
49 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
50# define XWLOGF_D(tag, fmt, ...) xwpf("C%d|D|" tag " " fmt, \
51 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
53# define XWLOGF_DEBUG(tag, fmt, ...) xwpf("D|" tag " " fmt, ##__VA_ARGS__)
54# define XWLOGF_D(tag, fmt, ...) xwpf("D|" tag " " fmt, ##__VA_ARGS__)
57# define XWLOGF_DEBUG(tag, fmt, ...)
58# define XWLOGF_D(tag, fmt, ...)
61#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 2)
62# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
63# define XWLOGF_INFO(tag, fmt, ...) xwpf("C%d|I|" tag " " fmt, \
64 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
65# define XWLOGF_I(tag, fmt, ...) xwpf("C%d|I|" tag " " fmt, \
66 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
68# define XWLOGF_INFO(tag, fmt, ...) xwpf("I|" tag " " fmt, ##__VA_ARGS__)
69# define XWLOGF_I(tag, fmt, ...) xwpf("I|" tag " " fmt, ##__VA_ARGS__)
72# define XWLOGF_INFO(tag, fmt, ...)
73# define XWLOGF_I(tag, fmt, ...)
76#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 3)
77# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
78# define XWLOGF_NOTICE(tag, fmt, ...) xwpf("C%d|N|" tag " " fmt, \
79 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
80# define XWLOGF_N(tag, fmt, ...) xwpf("C%d|N|" tag " " fmt, \
81 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
83# define XWLOGF_NOTICE(tag, fmt, ...) xwpf("N|" tag " " fmt, ##__VA_ARGS__)
84# define XWLOGF_N(tag, fmt, ...) xwpf("N|" tag " " fmt, ##__VA_ARGS__)
87# define XWLOGF_NOTICE(tag, fmt, ...)
88# define XWLOGF_N(tag, fmt, ...)
91#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 4)
92# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
93# define XWLOGF_WARNING(tag, fmt, ...) xwpf("C%d|W|" tag " " fmt, \
94 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
95# define XWLOGF_W(tag, fmt, ...) xwpf("C%d|W|" tag " " fmt, \
96 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
98# define XWLOGF_WARNING(tag, fmt, ...) xwpf("W|" tag " " fmt, ##__VA_ARGS__)
99# define XWLOGF_W(tag, fmt, ...) xwpf("W|" tag " " fmt, ##__VA_ARGS__)
102# define XWLOGF_WARNING(tag, fmt, ...)
103# define XWLOGF_W(tag, fmt, ...)
106#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 5)
107# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
108# define XWLOGF_ERR(tag, fmt, ...) xwpf("C%d|E|" tag " " fmt, \
109 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
110# define XWLOGF_E(tag, fmt, ...) xwpf("C%d|E|" tag " " fmt, \
111 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
113# define XWLOGF_ERR(tag, fmt, ...) xwpf("E|" tag " " fmt, ##__VA_ARGS__)
114# define XWLOGF_E(tag, fmt, ...) xwpf("E|" tag " " fmt, ##__VA_ARGS__)
117# define XWLOGF_ERR(tag, fmt, ...)
118# define XWLOGF_E(tag, fmt, ...)
121#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 6)
122# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
123# define XWLOGF_CRIT(tag, fmt, ...) xwpf("C%d|C|" tag " " fmt, \
124 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
125# define XWLOGF_C(tag, fmt, ...) xwpf("C%d|C|" tag " " fmt, \
126 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
128# define XWLOGF_CRIT(tag, fmt, ...) xwpf("C|" tag " " fmt, ##__VA_ARGS__)
129# define XWLOGF_C(tag, fmt, ...) xwpf("C|" tag " " fmt, ##__VA_ARGS__)
132# define XWLOGF_CRIT(tag, fmt, ...)
133# define XWLOGF_C(tag, fmt, ...)
136#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 7)
137# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
138# define XWLOGF_ALERT(tag, fmt, ...) xwpf("C%d|A|" tag " " fmt, \
139 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
140# define XWLOGF_A(tag, fmt, ...) xwpf("C%d|A|" tag " " fmt, \
141 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
143# define XWLOGF_ALERT(tag, fmt, ...) xwpf("A|" tag " " fmt, ##__VA_ARGS__)
144# define XWLOGF_A(tag, fmt, ...) xwpf("A|" tag " " fmt, ##__VA_ARGS__)
147# define XWLOGF_ALERT(tag, fmt, ...)
148# define XWLOGF_A(tag, fmt, ...)
151#if defined(XWLIBCFG_LOG) && (1 == XWLIBCFG_LOG) && (XWLIBCFG_XWLOG_LEVEL <= 8)
152# if defined(CPUCFG_CPU_NUM) && (CPUCFG_CPU_NUM > 1)
153# define XWLOGF_EMERG(tag, fmt, ...) xwpf("C%d|G|" tag " " fmt, \
154 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
155# define XWLOGF_G(tag, fmt, ...) xwpf("C%d|G|" tag " " fmt, \
156 xwos_skd_get_cpuid_lc(), ##__VA_ARGS__)
158# define XWLOGF_EMERG(tag, fmt, ...) xwpf("G|" tag " " fmt, ##__VA_ARGS__)
159# define XWLOGF_G(tag, fmt, ...) xwpf("G|" tag " " fmt, ##__VA_ARGS__)
162# define XWLOGF_EMERG(tag, fmt, ...)
163# define XWLOGF_G(tag, fmt, ...)
187#define xwlogf(lv, tag, fmt, ...) XWLOGF_##lv(tag, fmt, ##__VA_ARGS__)
int xwpf(const char *fmt,...)
格式化字符串并输出到日志,同 printf() 函数
xwer_t xwps(const char *str, xwsz_t size)
输出字符串