Useful for heavy users of qemu_log_mask that want to avoid executing expensive
logic that sets up a qemu_log_mask when that mask is disabled. E.G.

if (qemu_log_get_mask() && LOG_GUEST_ERROR) {
        /* do my expensive logging data query */
}
qemu_log_mask(LOG_GUEST_ERROR, ...)

Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com>
---

 include/qemu/log.h |    2 ++
 qemu-log.c         |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/qemu/log.h b/include/qemu/log.h
index 6b0db02..68188f0 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -154,6 +154,8 @@ static inline void qemu_set_log(int log_flags)
 #endif
 }
 
+int qemu_get_log_flags(void);
+
 void qemu_set_log_filename(const char *filename);
 int qemu_str_to_log_mask(const char *str);
 
diff --git a/qemu-log.c b/qemu-log.c
index 797f2af..2ffee1d 100644
--- a/qemu-log.c
+++ b/qemu-log.c
@@ -82,6 +82,11 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
     }
 }
 
+int qemu_get_log_flags(void)
+{
+    return qemu_loglevel;
+}
+
 void qemu_set_log_filename(const char *filename)
 {
     g_free(logfilename);
-- 
1.7.0.4


Reply via email to