From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: [PATCH 0/6] util: configurable / flexible error/log message output format
Date: Thu, 3 Dec 2026 17:25:37 +0000 [thread overview]
Message-ID: <20261203172543.676434-1-berrange@redhat.com> (raw)
At the start of the year I had a large series to add more info
to the error / log message output, so we can capture things
like thread names, IDs, and more, with more universal formatting
across both areas of code:
https://lists.nongnu.org/archive/html/qemu-devel/2026-02/msg03190.html
While much of the early supporting patches merged, Peter was not
convinced by some of the proposed changes, especially where it
affected the default output format:
https://lists.nongnu.org/archive/html/qemu-devel/2026-02/msg04960.html
I have now re-visited the work and decided on a substantially
different implementation approach.
Aside from Peter's issue, another issue was that the output
format was still substantially hardcoded. While you could turn
off/on individual data items with many new '-msg' flags, there
was no ability to control the order in which they were printed
nor any surrounding separators between fields.
In this new implementation, instead of adding lots of args to
'-msg', there is now a single "format string", which is a mix
of literal text and variable substitions, with some simple
conditions too. This gives the user far better control over
the output format.
Furthermore, the default output format has not been changed at
all from the current state.
So overall this this is a followup to my previous work, I am
calling it version 1, since it is a from scratch implementation.
Daniel P. Berrangé (6):
util: pull Location struct and APIs into location.{c,h}
util: add helper to query if a location is set
util: introduce a configurable message format template
util: convert log code to support QMessageFormat
util: convert error report code to use QMessageFormat
util: add '-msg format=FORMATSTR' argument
MAINTAINERS | 10 +
chardev/char.c | 3 +-
include/monitor/monitor.h | 2 +
include/qemu/error-report.h | 27 +-
include/qemu/location.h | 25 ++
include/qemu/log.h | 3 +
include/qemu/message-format.h | 97 ++++++
monitor/monitor.c | 15 +-
qemu-options.hx | 72 ++++-
stubs/meson.build | 1 +
stubs/monitor-core.c | 11 +
stubs/monitor-puts.c | 18 ++
system/vl.c | 35 +-
tests/unit/meson.build | 1 +
tests/unit/test-util-message-format.c | 226 +++++++++++++
util/error-report.c | 232 ++++---------
util/location.c | 137 ++++++++
util/log.c | 32 +-
util/meson.build | 2 +
util/message-format.c | 449 ++++++++++++++++++++++++++
20 files changed, 1202 insertions(+), 196 deletions(-)
create mode 100644 include/qemu/location.h
create mode 100644 include/qemu/message-format.h
create mode 100644 stubs/monitor-puts.c
create mode 100644 tests/unit/test-util-message-format.c
create mode 100644 util/location.c
create mode 100644 util/message-format.c
--
2.56.1
next reply other threads:[~2026-12-03 17:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 17:25 Daniel P. Berrangé [this message]
2026-12-03 17:25 ` [PATCH 1/6] util: pull Location struct and APIs into location.{c,h} Daniel P. Berrangé
2026-12-03 20:51 ` Eric Blake
2026-12-03 17:25 ` [PATCH 2/6] util: add helper to query if a location is set Daniel P. Berrangé
2026-12-03 20:51 ` Eric Blake
2026-12-03 17:25 ` [PATCH 3/6] util: introduce a configurable message format template Daniel P. Berrangé
2026-12-03 21:44 ` Eric Blake
2026-12-04 9:22 ` Daniel P. Berrangé
2026-12-04 0:32 ` Dr. David Alan Gilbert
2026-12-03 17:25 ` [PATCH 4/6] util: convert log code to support QMessageFormat Daniel P. Berrangé
2026-12-03 21:52 ` Eric Blake
2026-12-03 17:25 ` [PATCH 5/6] util: convert error report code to use QMessageFormat Daniel P. Berrangé
2026-12-03 21:55 ` Eric Blake
2026-12-03 17:25 ` [PATCH 6/6] util: add '-msg format=FORMATSTR' argument Daniel P. Berrangé
2026-12-03 22:02 ` Eric Blake
2026-12-04 9:23 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203172543.676434-1-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.