writer_format_fields


Description:

[ Version ( since = "2.50" ) ]
public string writer_format_fields (LogLevelFlags log_levels, LogField[] fields, bool use_color)

Format a structured log message as a string suitable for outputting to the terminal (or elsewhere).

This will include the values of all fields it knows how to interpret, which includes `MESSAGE` and `GLIB_DOMAIN` (see the documentation for [ func@GLib.log_structured]). It does not include values from unknown fields.

The returned string does **not** have a trailing new-line character. It is encoded in the character set of the current locale, which is not necessarily UTF-8.

Parameters:

fields

key–value pairs of structured data forming the log message

use_color

`TRUE` to use ANSI color escape sequences when formatting the message, `FALSE` to not

log_level

log level, either from [type@GLib.LogLevelFlags], or a user-defined level

n_fields

number of elements in the fields array

Returns:

string containing the formatted log message, in the character set of the current locale


Namespace: GLib.Log
Package: glib-2.0