[PATCH] util: Improve log out parsing errors

Martin Kletzander posted 1 patch 2 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/0a56a8c27d2be2a693bee3f7159cb785e6dd8442.1641389497.git.mkletzan@redhat.com
src/util/virlog.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] util: Improve log out parsing errors
Posted by Martin Kletzander 2 years, 3 months ago
Suggested-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 src/util/virlog.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virlog.c b/src/util/virlog.c
index 139dce8d0220..b44ad0ef6c47 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1487,21 +1487,21 @@ virLogParseOutput(const char *src)
     if (!(tokens = g_strsplit(src, ":", 0)) ||
         (count = g_strv_length(tokens)) < 2) {
         virReportError(VIR_ERR_INVALID_ARG,
-                       _("Malformed format for output '%s'"), src);
+                       _("Malformed format for log output '%s'"), src);
         return NULL;
     }
 
     if (virStrToLong_uip(tokens[0], NULL, 10, &prio) < 0 ||
         (prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR)) {
         virReportError(VIR_ERR_INVALID_ARG,
-                       _("Invalid priority '%s' for output '%s'"),
+                       _("Invalid log priority '%s' for log output '%s'"),
                        tokens[0], src);
         return NULL;
     }
 
     if ((dest = virLogDestinationTypeFromString(tokens[1])) < 0) {
         virReportError(VIR_ERR_INVALID_ARG,
-                       _("Invalid destination '%s' for output '%s'"),
+                       _("Invalid log destination '%s' for log output '%s'"),
                        tokens[1], src);
         return NULL;
     }
@@ -1511,7 +1511,7 @@ virLogParseOutput(const char *src)
         ((dest == VIR_LOG_TO_FILE ||
           dest == VIR_LOG_TO_SYSLOG) && count != 3)) {
         virReportError(VIR_ERR_INVALID_ARG,
-                       _("Output '%s' does not meet the format requirements "
+                       _("Log output '%s' does not meet the format requirements "
                          "for destination type '%s'"), src, tokens[1]);
         return NULL;
     }
-- 
2.34.1

Re: [PATCH] util: Improve log out parsing errors
Posted by Martin Kletzander 2 years, 3 months ago
Obviously s/out/output/ in $SUBJ

On Wed, Jan 05, 2022 at 02:31:37PM +0100, Martin Kletzander wrote:
>Suggested-by: Erik Skultety <eskultet@redhat.com>
>Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>---
> src/util/virlog.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/src/util/virlog.c b/src/util/virlog.c
>index 139dce8d0220..b44ad0ef6c47 100644
>--- a/src/util/virlog.c
>+++ b/src/util/virlog.c
>@@ -1487,21 +1487,21 @@ virLogParseOutput(const char *src)
>     if (!(tokens = g_strsplit(src, ":", 0)) ||
>         (count = g_strv_length(tokens)) < 2) {
>         virReportError(VIR_ERR_INVALID_ARG,
>-                       _("Malformed format for output '%s'"), src);
>+                       _("Malformed format for log output '%s'"), src);
>         return NULL;
>     }
>
>     if (virStrToLong_uip(tokens[0], NULL, 10, &prio) < 0 ||
>         (prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR)) {
>         virReportError(VIR_ERR_INVALID_ARG,
>-                       _("Invalid priority '%s' for output '%s'"),
>+                       _("Invalid log priority '%s' for log output '%s'"),
>                        tokens[0], src);
>         return NULL;
>     }
>
>     if ((dest = virLogDestinationTypeFromString(tokens[1])) < 0) {
>         virReportError(VIR_ERR_INVALID_ARG,
>-                       _("Invalid destination '%s' for output '%s'"),
>+                       _("Invalid log destination '%s' for log output '%s'"),
>                        tokens[1], src);
>         return NULL;
>     }
>@@ -1511,7 +1511,7 @@ virLogParseOutput(const char *src)
>         ((dest == VIR_LOG_TO_FILE ||
>           dest == VIR_LOG_TO_SYSLOG) && count != 3)) {
>         virReportError(VIR_ERR_INVALID_ARG,
>-                       _("Output '%s' does not meet the format requirements "
>+                       _("Log output '%s' does not meet the format requirements "
>                          "for destination type '%s'"), src, tokens[1]);
>         return NULL;
>     }
>-- 
>2.34.1
>
Re: [PATCH] util: Improve log out parsing errors
Posted by Michal Prívozník 2 years, 3 months ago
On 1/5/22 14:31, Martin Kletzander wrote:
> Suggested-by: Erik Skultety <eskultet@redhat.com>
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
>  src/util/virlog.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal