From nobody Sat Apr 27 04:17:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570695366; cv=none; d=zoho.com; s=zohoarc; b=kqd7A5YTT6N/cMEIDG0bK9cHXQKLl12gWzRbOqsmVL6g9jP7Zt+NxczTOiAxI/SgE3bCpht4+gH3uDq1ItfB/jM45BUL3O3rBXp0uuqwaJ9jOP4y2UBGbH/2oEAby0oi2RqJ7p4IOz/4wUrHdgYJGaqwhoUjT2fK+hmfIDrWu4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570695366; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=qZu0RCuFvbHL8jKZzzj2CzRMLxjA1X7Ge9ttT4U1yOU=; b=oGF/VK1brdnNmRfNxV660FUFvM5NXyUjOYK9bwhrFKTJQ5bq6UdmwoL6uzhxeWblarCXcdFjuTLdMM3U1T2H347WhqtgcWHVq8YJievLGH7/7DXeef+8hzfGh+KX2IR2lYdqUEE4mhTGX6Wn4ebBc3mY7Fn4GI6sm7Vqb6+smdk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570695366545590.7210497992469; Thu, 10 Oct 2019 01:16:06 -0700 (PDT) Received: from localhost ([::1]:34976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iITcD-00081i-DH for importer@patchew.org; Thu, 10 Oct 2019 04:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56205) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iITbS-0007WX-77 for qemu-devel@nongnu.org; Thu, 10 Oct 2019 04:15:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iITbO-0001gV-0m for qemu-devel@nongnu.org; Thu, 10 Oct 2019 04:15:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iITbN-0001dC-Od for qemu-devel@nongnu.org; Thu, 10 Oct 2019 04:15:13 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D920B18021A5; Thu, 10 Oct 2019 08:15:09 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7230600C4; Thu, 10 Oct 2019 08:15:09 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 28B401138619; Thu, 10 Oct 2019 10:15:08 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH] error: Fix -msg timestamp default Date: Thu, 10 Oct 2019 10:15:08 +0200 Message-Id: <20191010081508.8978-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Thu, 10 Oct 2019 08:15:09 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, msmarduch@digitalocean.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" -msg parameter "timestamp" defaults to "off" if you don't specify msg, and to "on" if you do. Messed up right in commit 5e2ac51917 "add timestamp to error_report()". Mostly harmless, because "timestamp" is the only parameter, so "if you do" is "-msg ''", which nobody does. Change the default to "off" no matter what. While there, rename enable_timestamp_msg to error_with_timestamp, and polish documentation. Signed-off-by: Markus Armbruster --- I stumbled over this during review of Mario's "[PATCHv2 0/2] log guest name and memory error type AO, AR for MCEs", which see. include/qemu/error-report.h | 3 ++- util/qemu-error.c | 6 ++++-- vl.c | 2 +- qemu-options.hx | 10 +++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h index 00d069b20f..87532d8596 100644 --- a/include/qemu/error-report.h +++ b/include/qemu/error-report.h @@ -73,6 +73,7 @@ void error_init(const char *argv0); }) =20 const char *error_get_progname(void); -extern bool enable_timestamp_msg; + +extern bool error_with_timestamp; =20 #endif diff --git a/util/qemu-error.c b/util/qemu-error.c index f373f3b3b0..dac7c7dc50 100644 --- a/util/qemu-error.c +++ b/util/qemu-error.c @@ -24,6 +24,9 @@ typedef enum { REPORT_TYPE_INFO, } report_type; =20 +/* Prepend timestamp to messages */ +bool error_with_timestamp; + int error_printf(const char *fmt, ...) { va_list ap; @@ -191,7 +194,6 @@ static void print_loc(void) } } =20 -bool enable_timestamp_msg; /* * Print a message to current monitor if we have one, else to stderr. * @report_type is the type of message: error, warning or informational. @@ -204,7 +206,7 @@ static void vreport(report_type type, const char *fmt, = va_list ap) GTimeVal tv; gchar *timestr; =20 - if (enable_timestamp_msg && !cur_mon) { + if (error_with_timestamp && !cur_mon) { g_get_current_time(&tv); timestr =3D g_time_val_to_iso8601(&tv); error_printf("%s ", timestr); diff --git a/vl.c b/vl.c index 002bf4919e..b8e4c11f02 100644 --- a/vl.c +++ b/vl.c @@ -1262,7 +1262,7 @@ static void realtime_init(void) =20 static void configure_msg(QemuOpts *opts) { - enable_timestamp_msg =3D qemu_opt_get_bool(opts, "timestamp", true); + error_with_timestamp =3D qemu_opt_get_bool(opts, "timestamp", false); } =20 =20 diff --git a/qemu-options.hx b/qemu-options.hx index 2a04ca6ac5..158244da0f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4165,13 +4165,17 @@ DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_= I386) =20 DEF("msg", HAS_ARG, QEMU_OPTION_msg, "-msg timestamp[=3Don|off]\n" - " change the format of messages\n" - " on|off controls leading timestamps (default:on)\n", + " control error message format\n" + " timestamp=3Don enables timestamps (default: off)\n", QEMU_ARCH_ALL) STEXI @item -msg timestamp[=3Don|off] @findex -msg -prepend a timestamp to each log message.(default:on) +Control error message format. +@table @option +@item timestamp=3Don|off +Prefix messages with a timestamp. Default is off. +@end table ETEXI =20 DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate, --=20 2.21.0