From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19052606A322 for ; Thu, 3 Dec 2026 17:26:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SPXwjG0o Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xZAZB-0002z5-Ss; Thu, 03 Dec 2026 12:25:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xZAZ9-0002yR-2y for qemu-devel@nongnu.org; Thu, 03 Dec 2026 12:25:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xZAZ7-0007cz-28 for qemu-devel@nongnu.org; Thu, 03 Dec 2026 12:25:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796318753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hL8nrEuApg8NB9/wdvJEzrEWGWFA52m7D0osz3QHtas=; b=SPXwjG0ot1SG1Z2MdW7LEwrQA+8cKRmNgwvpwhE2jw8ykuqqhsoAtBAn9yLdIYh76lzT8h fQoXZhpYww1QvzOLR6fjG6dBWVhy3gKNku6ZglPRujUOrqKcU9iD5y1iuUhiQetJOZD3Wj ropXZqA9sT1cGwHROKmUSupaLDts61w= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-_XedMux5OySrLkfZnN9mAA-1; Thu, 3 Dec 2026 17:25:48 +0000 X-MC-Unique: _XedMux5OySrLkfZnN9mAA-1 X-Mimecast-MFC-AGG-ID: _XedMux5OySrLkfZnN9mAA_1796318747 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 04648188EED1; Thu, 3 Dec 2026 17:25:47 +0000 (UTC) Received: from berrange.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0C44AB92; Thu, 3 Dec 2026 17:25:44 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , "Dr. David Alan Gilbert" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Peter Maydell , Richard Henderson Subject: [PATCH 0/6] util: configurable / flexible error/log message output format Date: Thu, 3 Dec 2026 17:25:37 +0000 Message-ID: <20261203172543.676434-1-berrange@redhat.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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