The message context can optionally include the guest name if the argument '-msg guest-name=on' is given. The formatting, however, does not look good if the guest name contains whitespace. Change the output to include square brackets to demarcate the name.
Before: # qemu-system-x86_64 -object tls-creds-x509,id=t0,dir=fish -d 'trace:qcrypto*' -msg guest-name=on -name "fish food" fish food qemu-system-x86_64(1146846:main): qcrypto_tls_creds_x509_load TLS creds x509 load creds=0x55657e94e690 dir=fish fish food qemu-system-x86_64(1146846:main): qcrypto_tls_creds_get_path TLS creds path creds=0x55657e94e690 filename=ca-cert.pem path=<none> fish food qemu-system-x86_64(1146846:main): Unable to access credentials fish/ca-cert.pem: No such file or directory After: # qemu-system-x86_64 -object tls-creds-x509,id=t0,dir=fish -d 'trace:qcrypto*' -msg guest-name=on -name "fish food" [fish food] qemu-system-x86_64(1144713:main): qcrypto_tls_creds_x509_load TLS creds x509 load creds=0x5604ada2c950 dir=fish [fish food] qemu-system-x86_64(1144713:main): qcrypto_tls_creds_get_path TLS creds path creds=0x5604ada2c950 filename=ca-cert.pem path=<none> [fish food] qemu-system-x86_64(1144713:main): Unable to access credentials fish/ca-cert.pem: No such file or directory Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> --- util/message.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/util/message.c b/util/message.c index 300dc10a4f..9ce2e27f5b 100644 --- a/util/message.c +++ b/util/message.c @@ -48,19 +48,21 @@ char *qmessage_context(int flags) uint64_t thid = qemu_thread_get_id(); const char *thname = qemu_thread_get_name(); - return g_strdup_printf("%s%s%s%s%s(%" PRIu64 ":%s): ", + return g_strdup_printf("%s%s%s%s%s%s(%" PRIu64 ":%s): ", timestr ? timestr : "", timestr ? " " : "", + wknamestr ? "[" : "", wknamestr ? wknamestr : "", - wknamestr ? " " : "", + wknamestr ? "] " : "", pgnamestr ? pgnamestr : "", thid, thname); } else { - return g_strdup_printf("%s%s%s%s%s%s", + return g_strdup_printf("%s%s%s%s%s%s%s", timestr ? timestr : "", timestr ? " " : "", + wknamestr ? "[" : "", wknamestr ? wknamestr : "", - wknamestr ? " " : "", + wknamestr ? "] " : "", pgnamestr ? pgnamestr : "", pgnamestr ? ": " : ""); } -- 2.50.1