writer_standard_streams


Description:

[ Version ( since = "2.50" ) ]
[ CCode ( delegate_target = false ) ]
public LogWriterFunc writer_standard_streams

Format a structured log message and print it to either `stdout` or `stderr`, depending on its log level.

[flags@GLib.LogLevelFlags.LEVEL_INFO] and [flags@GLib.LogLevelFlags.LEVEL_DEBUG] messages are sent to `stdout`, or to `stderr` if requested by [func@GLib.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 [type@GLib.LogWriterFunc].

Parameters:

fields

key–value pairs of structured data forming the log message

log_level

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

n_fields

number of elements in the fields array

user_data

user data passed to [func@GLib.log_set_writer_func]

Returns:

[enum@GLib.LogWriterOutput.HANDLED] on success, [enum@GLib.LogWriterOutput.UNHANDLED] otherwise


Namespace: GLib.Log
Package: glib-2.0