All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@linux.intel.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Zhao Liu <zhao1.liu@intel.com>
Subject: [RFC] util/error-report: Add "error: " prefix for error-level report
Date: Wed, 27 Mar 2024 19:46:09 +0800	[thread overview]
Message-ID: <20240327114609.3858483-1-zhao1.liu@linux.intel.com> (raw)

From: Zhao Liu <zhao1.liu@intel.com>

When vreport() was introduced, there was no prefix for error-level
(REPORT_TYPE_ERROR) report. The original reason is "To maintain
compatibility we don't add anything here" as Alistair said in his
RFC v3 series [1].

This was done in the context of inheriting the original error_report()
interface without the prefix style. And it was also useful to have a
means of error handling, such as exit(), when error occurs, so that the
error message - the most serious level - can be noticed by the user.

Nowadays, however, error_report() and its variants have a tendency to be
"abused": it is used a lot just for the sake of logging something more
noticeable than the "warn" or "info" level, in the absence of
appropriate error handling logic.

But, in the use case above, due to the lack of a prefix, it is in fact
less informative to the user than warn_report()/info_report() (with
"warn:" or "info: " prfix), which does not match its highest level.

Therefore, add "error: " prefix for error-level report.

[1]: https://lore.kernel.org/qemu-devel/87r2xuay5h.fsf@dusky.pond.sub.org/#t

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 util/error-report.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/error-report.c b/util/error-report.c
index 6e44a5573217..e981c0b032f0 100644
--- a/util/error-report.c
+++ b/util/error-report.c
@@ -213,6 +213,7 @@ static void vreport(report_type type, const char *fmt, va_list ap)
 
     switch (type) {
     case REPORT_TYPE_ERROR:
+        error_printf("error: ");
         break;
     case REPORT_TYPE_WARNING:
         error_printf("warning: ");
-- 
2.34.1



             reply	other threads:[~2024-03-27 11:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 11:46 Zhao Liu [this message]
2024-03-27 12:36 ` [RFC] util/error-report: Add "error: " prefix for error-level report Thomas Huth
2024-03-27 13:02   ` Zhao Liu
2024-03-29 11:10   ` Paolo Bonzini
2024-03-29 17:15     ` Zhao Liu

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=20240327114609.3858483-1-zhao1.liu@linux.intel.com \
    --to=zhao1.liu@linux.intel.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhao1.liu@intel.com \
    /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.