[libpeas] Print log hooks that were not hit



commit ab7a74ef75f235181015c302bf4a55c9c30414ce
Author: Garrett Regier <alias301 gmail com>
Date:   Thu Jun 9 22:39:25 2011 -0700

    Print log hooks that were not hit

 tests/testing-util/testing-util.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/tests/testing-util/testing-util.c b/tests/testing-util/testing-util.c
index f8c67b5..16bb221 100644
--- a/tests/testing-util/testing-util.c
+++ b/tests/testing-util/testing-util.c
@@ -60,6 +60,7 @@ log_handler (const gchar    *log_domain,
              gpointer        user_data)
 {
   guint i;
+  gboolean first = TRUE;
 
   /* We always want to log debug, info and message logs */
   if ((log_level & G_LOG_LEVEL_DEBUG) != 0 ||
@@ -109,6 +110,22 @@ log_handler (const gchar    *log_domain,
   g_log_default_handler (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR,
                          message, user_data);
 
+  for (i = 0; i < log_hooks->len; ++i)
+    {
+      LogHook *hook = g_ptr_array_index (log_hooks, i);
+
+      if (hook->hit)
+        continue;
+
+      if (first)
+        {
+          first = FALSE;
+          g_print ("Log hooks that were not hit:\n");
+        }
+
+      g_print ("\t'%s'\n", hook->pattern);
+    }
+
   /* The default handler does not actually abort */
   abort ();
 }



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