aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/qemu/log.h')
-rw-r--r--include/qemu/log.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/qemu/log.h b/include/qemu/log.h
index 1d0222d..cf38adb 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -78,6 +78,21 @@ qemu_log_vprintf(const char *fmt, va_list va)
} \
} while (0)
+/* log only if a bit is set on the current loglevel mask
+ * and we are in the address range we care about:
+ * @mask: bit to check in the mask
+ * @addr: address to check in dfilter
+ * @fmt: printf-style format string
+ * @args: optional arguments for format string
+ */
+#define qemu_log_mask_and_addr(MASK, ADDR, FMT, ...) \
+ do { \
+ if (unlikely(qemu_loglevel_mask(MASK)) && \
+ qemu_log_in_addr_range(ADDR)) { \
+ qemu_log(FMT, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
/* Maintenance: */
/* fflush() the log file */