On 14/03/2016 12:21, Denis V. Lunev wrote:
> From: Pavel Butsykin <[email protected]>
>
> Signed-off-by: Pavel Butsykin <[email protected]>
> Signed-off-by: Denis V. Lunev <[email protected]>
> CC: Stefan Hajnoczi <[email protected]>
> CC: Paolo Bonzini <[email protected]>
> CC: Luiz Capitulino <[email protected]>
> CC: Markus Armbruster <[email protected]>
> ---
> 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 },
> };
>
>