GLib.log_writer_journald
Description: Reference for GLib.log_writer_journald

### Function

# GLiblog_writer_journald

since: 2.50

#### Declaration [src]

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

#### Description [src]

Format a structured log message and send it to the systemd journal as a set of key–value pairs.

All fields are sent to the journal, but if a field has length zero (indicating program-specific data) then only its key will be sent.

This is suitable for use as a `GLogWriterFunc`.

If GLib has been compiled without systemd support, this function is still defined, but will always return `G_LOG_WRITER_UNHANDLED`.

Available since: 2.50

#### 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`

`G_LOG_WRITER_HANDLED` on success, `G_LOG_WRITER_UNHANDLED` otherwise.