GLib.log_variant
Description: Reference for GLib.log_variant

### Function

# GLiblog_variant

since: 2.50

#### Declaration

    void
    g_log_variant (
      const gchar* log_domain,
      GLogLevelFlags log_level,
      GVariant* fields
    )

#### Description

Log a message with structured data, accepting the data within a `GVariant`.

This version is especially useful for use in other languages, via introspection.

The only mandatory item in the `fields` dictionary is the `"MESSAGE"` which must contain the text shown to the user.

The values in the `fields` dictionary are likely to be of type `G_VARIANT_TYPE_STRING`. Array of bytes (`G_VARIANT_TYPE_BYTESTRING`) is also supported. In this case the message is handled as binary and will be forwarded to the log writer as such. The size of the array should not be higher than `G_MAXSSIZE`. Otherwise it will be truncated to this size. For other types `g_variant_print()` will be used to convert the value into a string.

For more details on its usage and about the parameters, see `g_log_structured()`.

Available since: 2.50

#### Parameters

`log_domain`

  Type: `const gchar*`

  Log domain, usually `G_LOG_DOMAIN`

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`log_level`

  Type: `GLogLevelFlags`

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

`fields`

  Type: `GVariant`

  A dictionary (`GVariant` of the type `G_VARIANT_TYPE_VARDICT`) containing the key-value pairs of message data.

  The data is owned by the caller of the function.