[gimp] app: fix severity output when redirected to stderr.



commit 77dcbb52bd57c3c3a96a2b8e53a5657227664638
Author: Jehan <jehan girinstud io>
Date:   Mon Feb 12 17:42:23 2018 +0100

    app: fix severity output when redirected to stderr.

 app/errors.c          |   18 ++++--------------
 app/gui/gui-message.c |    7 ++++++-
 2 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/app/errors.c b/app/errors.c
index e2933de..ec91a43 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -209,20 +209,10 @@ gimp_message_log_func (const gchar    *log_domain,
     }
   else
     {
-      const gchar *reason;
+      const gchar *reason = "Message";
 
-      switch (flags & G_LOG_LEVEL_MASK)
-        {
-        case G_LOG_LEVEL_WARNING:
-          reason = "WARNING";
-          break;
-        case G_LOG_LEVEL_CRITICAL:
-          reason = "CRITICAL";
-          break;
-        default:
-          reason = "MESSAGE";
-          break;
-        }
+      gimp_enum_get_value (GIMP_TYPE_MESSAGE_SEVERITY, severity,
+                           NULL, NULL, &reason, NULL);
 
       g_printerr ("%s: %s-%s: %s\n",
                   gimp_filename_to_utf8 (full_prog_name),
diff --git a/app/gui/gui-message.c b/app/gui/gui-message.c
index 60680c2..0559bc3 100644
--- a/app/gui/gui-message.c
+++ b/app/gui/gui-message.c
@@ -355,13 +355,18 @@ gui_message_error_dialog (Gimp                *gimp,
         }
       else
         {
+          const gchar *reason = "Message";
+
+          gimp_enum_get_value (GIMP_TYPE_MESSAGE_SEVERITY, severity,
+                               NULL, NULL, &reason, NULL);
+
           /* Since we overrided glib default's WARNING and CRITICAL
            * handler, if we decide not to handle this error in the end,
            * let's just print it in terminal in a similar fashion as
            * glib's default handler (though without the fancy terminal
            * colors right now).
            */
-          g_printerr ("%s-ERROR: %s\n", domain, message);
+          g_printerr ("%s-%s: %s\n", domain, reason, message);
 
           return TRUE;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]