Debug Logging

gboolean wp_log_level_is_enabled(GLogLevelFlags log_level)

Use this to figure out if a debug message is going to be printed or not, so that you can avoid allocating resources just for debug logging purposes.

Parameters
  • log_level – a log level

Returns

whether the log level is currently enabled

void wp_log_set_level(const gchar *level_str)

Configures the log level and enabled categories.

Parameters
  • level_str – a log level description string as it would appear in the WIREPLUMBER_DEBUG environment variable “level:category1,category2”

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

WirePlumber’s GLogWriterFunc.

This is installed automatically when you call wp_init() with WP_INIT_SET_GLIB_LOG set in the flags

void wp_log_structured_standard(const gchar *log_domain, GLogLevelFlags log_level, const gchar *file, const gchar *line, const gchar *func, GType object_type, gconstpointer object, const gchar *message_format, ...)

Used internally by the debug logging macros. Avoid using it directly.

struct spa_log *wp_spa_log_get_instance(void)

Gets WirePlumber’s instance of spa_log

Returns

WirePlumber’s instance of spa_log, which can be used to redirect PipeWire’s log messages to the currently installed GLogWriterFunc. This is installed automatically when you call wp_init() with WP_INIT_SET_PW_LOG set in the flags

WP_LOG_LEVEL_TRACE (1 << G_LOG_LEVEL_USER_SHIFT)

A custom GLib log level for trace messages (see GLogLevelFlags)

WP_OBJECT_FORMAT "<%s:%p>"

A format string to print GObjects with WP_OBJECT_ARGS() For example:

GObject *myobj = ...;
wp_debug ("This: " WP_OBJECT_FORMAT " is an object", WP_OBJECT_ARGS (myobj));

WP_OBJECT_ARGS(object)     (object ? G_OBJECT_TYPE_NAME(object) : "invalid"), object

A macro to format an object for printing with WP_OBJECT_FORMAT.

wp_critical(...) wp_log (G_LOG_LEVEL_CRITICAL, 0, NULL, __VA_ARGS__)

Logs a critical message to the standard log via GLib’s logging system.

Parameters
  • ... – A format string, followed by format arguments in printf() style

wp_critical_object(object, ...) wp_log (G_LOG_LEVEL_CRITICAL, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)

Logs a critical message to the standard log via GLib’s logging system.

Parameters
  • object – A GObject associated with the log; this is printed in a special way to make it easier to track messages from a specific object

  • ... – A format string, followed by format arguments in printf() style

wp_critical_boxed(type, object, ...) wp_log (G_LOG_LEVEL_CRITICAL, type, object, __VA_ARGS__)

Logs a critical message to the standard log via GLib’s logging system.

Parameters
  • type – The type of object

  • object – A boxed object associated with the log; this is printed in a special way to make it easier to track messages from a specific object. For some object types, contents from the object are also printed (ex WpSpaPod)

  • ... – A format string, followed by format arguments in printf() style

wp_warning(...) wp_log (G_LOG_LEVEL_WARNING, 0, NULL, __VA_ARGS__)

Logs a warning message to the standard log via GLib’s logging system.

Parameters
  • ... – A format string, followed by format arguments in printf() style

wp_warning_object(object, ...) wp_log (G_LOG_LEVEL_WARNING, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)

Logs a warning message to the standard log via GLib’s logging system.

Parameters
  • object – A GObject associated with the log; this is printed in a special way to make it easier to track messages from a specific object

  • ... – A format string, followed by format arguments in printf() style

wp_warning_boxed(type, object, ...) wp_log (G_LOG_LEVEL_WARNING, type, object, __VA_ARGS__)

Logs a warning message to the standard log via GLib’s logging system.

Parameters
  • type – The type of object

  • object – A boxed object associated with the log; this is printed in a special way to make it easier to track messages from a specific object. For some object types, contents from the object are also printed (ex WpSpaPod)

  • ... – A format string, followed by format arguments in printf() style

wp_message(...) wp_log (G_LOG_LEVEL_MESSAGE, 0, NULL, __VA_ARGS__)

Logs a standard message to the standard log via GLib’s logging system.

Parameters
  • ... – A format string, followed by format arguments in printf() style

wp_message_object(object, ...) wp_log (G_LOG_LEVEL_MESSAGE, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)

Logs a standard message to the standard log via GLib’s logging system.

Parameters
  • object – A GObject associated with the log; this is printed in a special way to make it easier to track messages from a specific object

  • ... – A format string, followed by format arguments in printf() style

wp_message_boxed(type, object, ...) wp_log (G_LOG_LEVEL_MESSAGE, type, object, __VA_ARGS__)

Logs a standard message to the standard log via GLib’s logging system.

Parameters
  • type – The type of object

  • object – A boxed object associated with the log; this is printed in a special way to make it easier to track messages from a specific object. For some object types, contents from the object are also printed (ex WpSpaPod)

  • ... – A format string, followed by format arguments in printf() style

wp_info(...) wp_log (G_LOG_LEVEL_INFO, 0, NULL, __VA_ARGS__)

Logs a info message to the standard log via GLib’s logging system.

Parameters
  • ... – A format string, followed by format arguments in printf() style

wp_info_object(object, ...) wp_log (G_LOG_LEVEL_INFO, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)

Logs a info message to the standard log via GLib’s logging system.

Parameters
  • object – A GObject associated with the log; this is printed in a special way to make it easier to track messages from a specific object

  • ... – A format string, followed by format arguments in printf() style

wp_info_boxed(type, object, ...) wp_log (G_LOG_LEVEL_INFO, type, object, __VA_ARGS__)

Logs a info message to the standard log via GLib’s logging system.

Parameters
  • type – The type of object

  • object – A boxed object associated with the log; this is printed in a special way to make it easier to track messages from a specific object. For some object types, contents from the object are also printed (ex WpSpaPod)

  • ... – A format string, followed by format arguments in printf() style

wp_debug(...) wp_log (G_LOG_LEVEL_DEBUG, 0, NULL, __VA_ARGS__)

Logs a debug message to the standard log via GLib’s logging system.

Parameters
  • ... – A format string, followed by format arguments in printf() style

wp_debug_object(object, ...) wp_log (G_LOG_LEVEL_DEBUG, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)

Logs a debug message to the standard log via GLib’s logging system.

Parameters
  • object – A GObject associated with the log; this is printed in a special way to make it easier to track messages from a specific object

  • ... – A format string, followed by format arguments in printf() style

wp_debug_boxed(type, object, ...) wp_log (G_LOG_LEVEL_DEBUG, type, object, __VA_ARGS__)

Logs a debug message to the standard log via GLib’s logging system.

Parameters
  • type – The type of object

  • object – A boxed object associated with the log; this is printed in a special way to make it easier to track messages from a specific object. For some object types, contents from the object are also printed (ex WpSpaPod)

  • ... – A format string, followed by format arguments in printf() style

wp_trace(...) wp_log (WP_LOG_LEVEL_TRACE, 0, NULL, __VA_ARGS__)

Logs a trace message to the standard log via GLib’s logging system.

Parameters
  • ... – A format string, followed by format arguments in printf() style

wp_trace_object(object, ...) wp_log (WP_LOG_LEVEL_TRACE, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)

Logs a trace message to the standard log via GLib’s logging system.

Parameters
  • object – A GObject associated with the log; this is printed in a special way to make it easier to track messages from a specific object

  • ... – A format string, followed by format arguments in printf() style

wp_trace_boxed(type, object, ...) wp_log (WP_LOG_LEVEL_TRACE, type, object, __VA_ARGS__)

Logs a trace message to the standard log via GLib’s logging system.

Parameters
  • type – The type of object

  • object – A boxed object associated with the log; this is printed in a special way to make it easier to track messages from a specific object. For some object types, contents from the object are also printed (ex WpSpaPod)

  • ... – A format string, followed by format arguments in printf() style

wp_log(level, type, object, ...)

({ \

if (G_UNLIKELY (

wp_log_level_is_enabled (level))) \     wp_log_structured_standard

(G_LOG_DOMAIN, level, __FILE__, \

G_STRINGIFY (__LINE__), G_STRFUNC, type, object, __VA_ARGS__); \

})


The generic form of all the logging macros.

Remark

Don’t use this directly, use one of the other logging macros