Function
GLiblog_writer_format_fields
since: 2.50
Declaration
gchar*
g_log_writer_format_fields (
GLogLevelFlags log_level,
const GLogField* fields,
gsize n_fields,
gboolean use_color
)
Description
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 g_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.
Available since: 2.50
Parameters
log_level-
Type:
GLogLevelFlagsLog level, either from
GLogLevelFlags, or a user-defined level. fields-
Type: An array of
GLogFieldKey–value pairs of structured data forming the log message.
The length of the array is specified in the n_fieldsargument.The data is owned by the caller of the function. n_fields-
Type:
gsizeNumber of elements in the
fieldsarray. use_color-
Type:
gbooleanTRUEto use ANSI color escape sequences when formatting the message,FALSEto not.