Message ID | 1457954501-26528-9-git-send-email-den@openvz.org |
---|---|
State | New |
Headers | show |
On 14/03/2016 12:21, Denis V. Lunev wrote: > From: Pavel Butsykin <pbutsykin@virtuozzo.com> > > Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com> > Signed-off-by: Denis V. Lunev <den@openvz.org> > CC: Stefan Hajnoczi <stefanha@redhat.com> > CC: Paolo Bonzini <pbonzini@redhat.com> > CC: Luiz Capitulino <lcapitulino@redhat.com> > CC: Markus Armbruster <armbru@redhat.com> > --- > 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) This should just reuse LOG_QMP (but see reply to patch 6). Paolo > /* 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 }, > }; > >
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 }, };