| Submitter | Andreas Färber |
|---|---|
| Date | Feb. 21, 2013, 4:24 a.m. |
| Message ID | <1361420711-15698-4-git-send-email-afaerber@suse.de> |
| Download | mbox | patch |
| Permalink | /patch/222172/ |
| State | New |
| Headers | show |
Comments
Andreas Färber <afaerber@suse.de> writes:
> Corresponds to existing qemu_log_vprintf() but uses a mask.
qemu_log_vprintf() has just two callers. Perhaps it could be replaced
by your qemu_log_mask_vprintf(). Just an idea, no need to respin
because of this.
Patch
diff --git a/include/qemu/log.h b/include/qemu/log.h index 5a46555..9dd7a3e 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -64,6 +64,22 @@ qemu_log_vprintf(const char *fmt, va_list va) */ void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...); +/** + * qemu_log_mask_vprintf: + * @mask: The loglevel mask. + * @fmt: The format string. + * @va: The list of arguments to insert into the log. + * + * Equivalent of qemu_log_mask(). + */ +static inline void GCC_FMT_ATTR(2, 0) +qemu_log_mask_vprintf(int mask, const char *fmt, va_list va) +{ + if ((qemu_loglevel & mask) && qemu_logfile) { + vfprintf(qemu_logfile, fmt, va); + } +} + /* Special cases: */
Corresponds to existing qemu_log_vprintf() but uses a mask. Signed-off-by: Andreas Färber <afaerber@suse.de> --- include/qemu/log.h | 16 ++++++++++++++++ 1 Datei geändert, 16 Zeilen hinzugefügt(+)