### Function

# GLib log_set_writer_func

since: 2.50

#### Declaration

    void
    g_log_set_writer_func (
      GLogWriterFunc func,
      gpointer user_data,
      GDestroyNotify user_data_free
    )

#### Description

Set a writer function which will be called to format and write out each log message.

Each program should set a writer function, or the default writer (`g_log_writer_default()`) will be used.

Libraries must not call this function — only programs are allowed to install a writer function, as there must be a single, central point where log messages are formatted and outputted.

There can only be one writer function. It is an error to set more than one.

Available since: 2.50

#### Parameters

`func`

  Type: `GLogWriterFunc`

  Log writer function, which must not be `NULL`

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  User data to pass to `func`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`user_data_free`

  Type: `GDestroyNotify`

  Function to free `user_data` once it’s finished with, if non-`NULL`