GLib.log_writer_syslog
Description: Reference for GLib.log_writer_syslog

### Function

# GLiblog_writer_syslog

since: 2.80

#### Declaration

    GLogWriterOutput
    g_log_writer_syslog (
      GLogLevelFlags log_level,
      const GLogField* fields,
      gsize n_fields,
      gpointer user_data
    )

#### Description

Format a structured log message and send it to the syslog daemon. Only fields which are understood by this function are included in the formatted string which is printed.

Log facility will be defined via the SYSLOG_FACILITY field and accepts the following values: “auth”, “daemon”, and “user”. If SYSLOG_FACILITY is not specified, LOG_USER facility will be used.

This is suitable for use as a `GLogWriterFunc`.

If syslog is not supported, this function is still defined, but will always return `GLogWriterOutput`.

Available since: 2.80

#### Parameters

`log_level`

  Type: `GLogLevelFlags`

  Log level, either from `GLogLevelFlags`, or a user-defined level.

`fields`

  Type: An array of `GLogField`

  Key–value pairs of structured data forming the log message.

  The length of the array is specified in the `n_fields` argument.
  The data is owned by the caller of the function.

`n_fields`

  Type: `gsize`

  Number of elements in the `fields` array.

`user_data`

  Type: `gpointer`

  User data passed to `g_log_set_writer_func()`

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

#### Return value

Type: `GLogWriterOutput`

`GLogWriterOutput` on success, `GLogWriterOutput` otherwise.