LogWriterFunc


Description:

[ Version ( since = "2.50" ) ]
public delegate LogWriterOutput LogWriterFunc (LogLevelFlags log_level, LogField[] fields)

Writer function for log entries.

A log entry is a collection of one or more LogFields, using the standard [field names from journal specification](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html). See log_structured for more information.

Writer functions must ignore fields which they do not recognise, unless they can write arbitrary binary output, as field values may be arbitrary binary.

log_level is guaranteed to be included in fields as the `PRIORITY` field, but is provided separately for convenience of deciding whether or where to output the log entry.

Writer functions should return g_log_writer_handled if they handled the log message successfully or if they deliberately ignored it. If there was an error handling the message (for example, if the writer function is meant to send messages to a remote logging server and there is a network error), it should return g_log_writer_unhandled. This allows writer functions to be chained and fall back to simpler handlers in case of failure.

Parameters:

log_level

log level of the message

fields

fields forming the message

n_fields

number of fields

user_data

user data passed to set_writer_func

Returns:

g_log_writer_handled if the log entry was handled successfully; g_log_writer_unhandled otherwise


Namespace: GLib
Package: glib-2.0