log_set_fatal_handler


Description:

[ Version ( since = "2.22" ) ]
public void log_set_fatal_handler (LogFatalFunc log_func)

Installs a non-error fatal log handler which can be used to decide whether log messages which are counted as fatal abort the program.

The use case here is that you are running a test case that depends on particular libraries or circumstances and cannot prevent certain known critical or warning messages. So you install a handler that compares the domain and message to precisely not abort in such a case.

Note that the handler is reset at the beginning of any test case, so you have to set it inside each test function which needs the special behavior.

This handler has no effect on g_error messages.

This handler also has no effect on structured log messages (using [func@GLib.log_structured] or [func@GLib.log_structured_array]). To change the fatal behaviour for specific log messages, programs must install a custom log writer function using [func@GLib.log_set_writer_func].See [ Using Structured Logging](logging.html#using-structured-logging).

Parameters:

log_func

the log handler function.

user_data

data passed to the log handler.


Namespace: GLib.Test
Package: glib-2.0