From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afQZh-0001Kc-Nj for qemu-devel@nongnu.org; Mon, 14 Mar 2016 07:22:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afQZg-0003T0-Tv for qemu-devel@nongnu.org; Mon, 14 Mar 2016 07:22:13 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:13580 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afQZg-0003Sc-HP for qemu-devel@nongnu.org; Mon, 14 Mar 2016 07:22:12 -0400 From: "Denis V. Lunev" Date: Mon, 14 Mar 2016 14:21:40 +0300 Message-Id: <1457954501-26528-9-git-send-email-den@openvz.org> In-Reply-To: <1457954501-26528-1-git-send-email-den@openvz.org> References: <1457954501-26528-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 8/9] log: report QAPI event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Butsykin , Markus Armbruster , qemu-devel@nongnu.org, Luiz Capitulino , Stefan Hajnoczi , Paolo Bonzini , "Denis V. Lunev" From: Pavel Butsykin Signed-off-by: Pavel Butsykin Signed-off-by: Denis V. Lunev CC: Stefan Hajnoczi CC: Paolo Bonzini CC: Luiz Capitulino CC: Markus Armbruster --- include/qemu/log.h | 1 + monitor.c | 6 ++++++ util/log.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/include/qemu/log.h b/include/qemu/log.h index 9264bbf..0c7a564 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -44,6 +44,7 @@ static inline bool qemu_log_separate(void) #define LOG_TRACE (1 << 15) #define LOG_QMP (1 << 16) #define LOG_HMP (1 << 17) +#define LOG_QAPI (1 << 18) /* Returns true if a bit is set in the current loglevel mask */ diff --git a/monitor.c b/monitor.c index 4bf4f31..751e754 100644 --- a/monitor.c +++ b/monitor.c @@ -467,6 +467,12 @@ static void monitor_qapi_event_emit(QAPIEvent event, QDict *qdict) { Monitor *mon; + if (qemu_loglevel_mask(LOG_QAPI)) { + QString *output_json = qobject_to_json(QOBJECT(qdict)); + qemu_log_mask(LOG_QAPI, "QAPI event: %s\n", output_json->string); + QDECREF(output_json); + } + trace_monitor_protocol_event_emit(event, qdict); QLIST_FOREACH(mon, &mon_list, entry) { if (monitor_is_qmp(mon) && mon->qmp.in_command_mode) { diff --git a/util/log.c b/util/log.c index 795aaea..572f005 100644 --- a/util/log.c +++ b/util/log.c @@ -135,6 +135,8 @@ const QEMULogItem qemu_log_items[] = { "log the QMP commands and events" }, { LOG_HMP, "hmp", "log the HMP commands and events" }, + { LOG_QAPI, "qapi", + "log the QAPI events"}, { 0, NULL, NULL }, }; -- 2.5.0