g_log: mask log level before checking prefix flags
authorRyan Lortie <desrt@desrt.ca>
Wed, 14 Mar 2012 00:10:39 +0000 (20:10 -0400)
committerRyan Lortie <desrt@desrt.ca>
Wed, 14 Mar 2012 00:15:21 +0000 (20:15 -0400)
We check if the log level is in the "prefixed" list by checking it
against the g_log_msg_prefix bitfield.

Unfortunately we were failing to mask by G_LOG_LEVEL_MASK first, so if
the FATAL bit was set (for example) then it would never match.  This was
the case for g_error().

https://bugzilla.gnome.org/show_bug.cgi?id=672026

glib/gmessages.c

index 7dafbf5..4230f08 100644 (file)
@@ -1209,7 +1209,7 @@ g_log_default_handler (const gchar   *log_domain,
   if (!log_domain)
     g_string_append (gstring, "** ");
 
-  if ((g_log_msg_prefix & log_level) == log_level)
+  if ((g_log_msg_prefix & (log_level & G_LOG_LEVEL_MASK)) == (log_level & G_LOG_LEVEL_MASK))
     {
       const gchar *prg_name = g_get_prgname ();