Function

GLibset_printerr_handler

Declaration

GPrintFunc
g_set_printerr_handler (
  GPrintFunc func
)

Description

Sets the handler for printing error messages to func, or resets it to the default GLib handler if NULL.

Any messages passed to g_printerr() will be output via the new handler. The default handler outputs the encoded message to stderr. By providing your own handler you can redirect the output, to a GTK widget or a log file for example.

Since 2.76 this functions always returns a valid GPrintFunc, and never returns NULL. If no custom error print handler was set, it will return the GLib default error print handler and that can be re-used to decorate its output and/or to write to stderr in all platforms. Before GLib 2.76, this was NULL.

This function is not directly available to language bindings.

Parameters

func

Type: GPrintFunc

He new error message handler or NULL to reset to the default.

The argument can be NULL.

Return value

Type: GPrintFunc

The old error message handler.