[gimp] app, libgimp: add log handlers for all LibGimp* log domains



commit 5e591eb232b60baa1392ab83772ba6e6652cda7c
Author: Michael Natterer <mitch gimp org>
Date:   Wed May 20 11:05:45 2015 +0200

    app, libgimp: add log handlers for all LibGimp* log domains
    
    Looks like they were forgotten so messages from libs went to stdout
    instead of being routed through the log handlers, which would show
    them in a dialog, or in the error console.

 app/errors.c   |   11 ++++++++++-
 libgimp/gimp.c |   34 +++++++++++++++++++++++++---------
 2 files changed, 35 insertions(+), 10 deletions(-)
---
diff --git a/app/errors.c b/app/errors.c
index 417e1e7..406de17 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -86,8 +86,10 @@ errors_init (Gimp               *gimp,
     "Gimp-Dialogs",
     "Gimp-Display",
     "Gimp-File",
+    "Gimp-GEGL",
     "Gimp-GUI",
     "Gimp-Menus",
+    "Gimp-Operations",
     "Gimp-PDB",
     "Gimp-Paint",
     "Gimp-Paint-Funcs",
@@ -96,7 +98,14 @@ errors_init (Gimp               *gimp,
     "Gimp-Tools",
     "Gimp-Vectors",
     "Gimp-Widgets",
-    "Gimp-XCF"
+    "Gimp-XCF",
+    "LibGimpBase",
+    "LibGimpColor",
+    "LibGimpConfig",
+    "LibGimpMath",
+    "LibGimpModule",
+    "LibGimpThumb",
+    "LibGimpWidgets"
   };
   gint i;
 
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index e7b26fe..f1b44d1 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -491,15 +491,31 @@ gimp_main (const GimpPlugInInfo *info,
 
 
   /* set handler both for the "LibGimp" and "" domains */
-
-  g_log_set_handler (G_LOG_DOMAIN,
-                     G_LOG_LEVEL_MESSAGE,
-                     gimp_message_func,
-                     NULL);
-  g_log_set_handler (NULL,
-                     G_LOG_LEVEL_MESSAGE,
-                     gimp_message_func,
-                     NULL);
+  {
+    const gchar * const log_domains[] =
+    {
+      "LibGimp",
+      "LibGimpBase",
+      "LibGimpColor",
+      "LibGimpConfig",
+      "LibGimpMath",
+      "LibGimpModule",
+      "LibGimpThumb",
+      "LibGimpWidgets"
+    };
+    gint i;
+
+    for (i = 0; i < G_N_ELEMENTS (log_domains); i++)
+      g_log_set_handler (log_domains[i],
+                         G_LOG_LEVEL_MESSAGE,
+                         gimp_message_func,
+                         NULL);
+
+    g_log_set_handler (NULL,
+                       G_LOG_LEVEL_MESSAGE,
+                       gimp_message_func,
+                       NULL);
+  }
 
   if (gimp_debug_flags & GIMP_DEBUG_FATAL_WARNINGS)
     {


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