g_log: mask log level before checking prefix flags

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
This commit is contained in:
Ryan Lortie 2012-03-13 20:10:39 -04:00
parent 545736c0fb
commit fbbdf98668

View 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 ();