Re: Bug in glib in g_logv



Tim Janik wrote:


> if you want your handler to catch all messages in your domain, simply always
> add (G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL) to the log_levels mask when
> calling g_log_set_handler().

I had exactly the same problem a while back.

I've updated the docs to this:


<!-- ##### FUNCTION g_log_set_handler ##### -->
<para>
Sets the log handler for a domain and a set of log levels.
Note that to handle fatal and recursive messages the @log_levels
parameter
must be combined with the G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSIVE bit
flags.

<example>
<title>Adding a log handler for all warning messages</title>
<programlisting>
  g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
                     | G_LOG_FLAG_RECURSIVE, my_log_handler, NULL);
</programlisting>
</example>
</para>

@log_domain: the log domain, or NULL for the default "" application
domain.
@log_levels: the log levels to apply the log handler for. To handle
fatal
and recursive messages as well, comine the log levels with the
G_LOG_FLAG_FATAL
and G_LOG_FLAG_RECURSIVE bit flags.
@log_func: the log handler function.
@user_data: data passed to the log handler.
@Returns: the id of the new handler.



Damon




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