xref: /openbmc/qemu/include/qemu/log-for-trace.h (revision 3c06a417)
1 /* log-for-trace.h: logging basics required by the trace.h generated
2  * by the log trace backend.
3  *
4  * This should not be included directly by any .c file: if you
5  * need to use the logging functions include "qemu/log.h".
6  *
7  * The purpose of splitting these parts out into their own header
8  * is to catch the easy mistake where a .c file includes trace.h
9  * but forgets to include qemu/log.h. Without this split, that
10  * would result in the .c file compiling fine when the default
11  * trace backend is in use but failing to compile with any other
12  * backend.
13  *
14  * This code is licensed under the GNU General Public License,
15  * version 2 or (at your option) any later version.
16  */
17 
18 #ifndef QEMU_LOG_FOR_TRACE_H
19 #define QEMU_LOG_FOR_TRACE_H
20 
21 /* Private global variable, don't use */
22 extern int qemu_loglevel;
23 
24 #define LOG_TRACE          (1 << 15)
25 
26 /* Returns true if a bit is set in the current loglevel mask */
qemu_loglevel_mask(int mask)27 static inline bool qemu_loglevel_mask(int mask)
28 {
29     return (qemu_loglevel & mask) != 0;
30 }
31 
32 /* main logging function */
33 void G_GNUC_PRINTF(1, 2) qemu_log(const char *fmt, ...);
34 
35 #endif
36