set_print_handler
Description:
Sets the print handler to func
, or resets it to the default GLib handler if `NULL`.
Any messages passed to [func@GLib.print] will be output via the new handler. The default handler outputs the encoded message to `stdout`. 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 [type@GLib.PrintFunc], and never returns `NULL`. If no custom print handler was set, it will return the GLib default 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`.
Parameters:
func |
the new print handler or `NULL` to reset to the default |
Returns:
the old print handler |
Namespace: GLib
Package: glib-2.0