Function

GLiblog_writer_standard_streams

Declaration

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

Description

Format a structured log message and print it to either stdout or stderr, depending on its log level. G_LOG_LEVEL_INFO and G_LOG_LEVEL_DEBUG messages are sent to stdout, or to stderr if requested by g_log_writer_default_set_use_stderr(); all other log levels are sent to stderr. Only fields which are understood by this function are included in the formatted string which is printed.

If the output stream supports ANSI color escape sequences, they will be used in the output.

A trailing new-line character is added to the log message when it is printed.

This is suitable for use as a GLogWriterFunc.

Available since:2.50

Parameters

log_level GLogLevelFlags
 

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

fields 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 gsize
 

Number of elements in the fields array.

user_data gpointer
 

User data passed to g_log_set_writer_func()

Return value

Returns: GLogWriterOutput
 

G_LOG_WRITER_HANDLED on success, G_LOG_WRITER_UNHANDLED otherwise.