Upstream: https://gitlab.com/qemu-project/qemu.git Upstream-Commit: d2e570cc0f97b936902a5b1b86b73c0f5998b475
51 lines
1.6 KiB
C
51 lines
1.6 KiB
C
/* log-for-trace.h: logging basics required by the trace.h generated
|
|
* by the log trace backend.
|
|
*
|
|
* This should not be included directly by any .c file: if you
|
|
* need to use the logging functions include "qemu/log.h".
|
|
*
|
|
* The purpose of splitting these parts out into their own header
|
|
* is to catch the easy mistake where a .c file includes trace.h
|
|
* but forgets to include qemu/log.h. Without this split, that
|
|
* would result in the .c file compiling fine when the default
|
|
* trace backend is in use but failing to compile with any other
|
|
* backend.
|
|
*
|
|
* This code is licensed under the GNU General Public License,
|
|
* version 2 or (at your option) any later version.
|
|
*/
|
|
|
|
#ifndef QEMU_LOG_FOR_TRACE_H
|
|
#define QEMU_LOG_FOR_TRACE_H
|
|
|
|
/* Private global variable, don't use */
|
|
extern unsigned qemu_loglevel;
|
|
|
|
#define LOG_TRACE (1u << 15)
|
|
|
|
/* Returns true if a bit is set in the current loglevel mask */
|
|
static inline bool qemu_loglevel_mask(int mask)
|
|
{
|
|
return (qemu_loglevel & mask) != 0;
|
|
}
|
|
|
|
/**
|
|
* qemu_log: report a log message
|
|
* @fmt: the format string for the message
|
|
* @...: the format string arguments
|
|
*
|
|
* This will emit a log message to the current output stream.
|
|
*
|
|
* The @fmt string should normally represent a complete line
|
|
* of text, and thus end with a newline character.
|
|
*
|
|
* While it is possible to incrementally output fragments of
|
|
* a complete line using qemu_log, this is inefficient and
|
|
* races with other threads. For outputting fragments it is
|
|
* strongly preferred to use the qemu_log_trylock() method
|
|
* combined with fprintf().
|
|
*/
|
|
void G_GNUC_PRINTF(1, 2) qemu_log(const char *fmt, ...);
|
|
|
|
#endif
|