From patchwork Mon Mar 14 11:21:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 8578541 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B8F179F294 for ; Mon, 14 Mar 2016 11:27:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2445D20154 for ; Mon, 14 Mar 2016 11:27:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62837200CF for ; Mon, 14 Mar 2016 11:27:24 +0000 (UTC) Received: from localhost ([::1]:40229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afQeh-0001NO-Er for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Mar 2016 07:27:23 -0400 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 Received: from hades.sw.ru ([10.30.8.132]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u2EBLf99003660; Mon, 14 Mar 2016 14:21:57 +0300 (MSK) From: "Denis V. Lunev" To: Date: Mon, 14 Mar 2016 14:21:40 +0300 Message-Id: <1457954501-26528-9-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457954501-26528-1-git-send-email-den@openvz.org> References: <1457954501-26528-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: Pavel Butsykin , Markus Armbruster , qemu-devel@nongnu.org, Luiz Capitulino , Stefan Hajnoczi , Paolo Bonzini , "Denis V. Lunev" Subject: [Qemu-devel] [PATCH 8/9] log: report QAPI event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 }, };