Function

GLibtest_log_set_fatal_handler

Declaration [src]

void
g_test_log_set_fatal_handler (
  GTestLogFatalFunc log_func,
  gpointer user_data
)

Description [src]

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 g_log_structured() or g_log_structured_array()). To change the fatal behaviour for specific log messages, programs must install a custom log writer function using g_log_set_writer_func().See [Using Structured Logging][using-structured-logging].

Available since:2.22

Parameters

log_func GTestLogFatalFunc
 

The log handler function.

user_data gpointer
 

Data passed to the log handler.