Debug Logging

void wp_log_topic_register(WpLogTopic *topic)

Registers a log topic.

The log topic must be unregistered using wp_log_topic_unregister before its lifetime ends.

This function is threadsafe.

void wp_log_topic_unregister(WpLogTopic *topic)

Unregisters a log topic.

This function is threadsafe.

void wp_log_topic_init(WpLogTopic *topic)

Initializes a log topic. Internal function, don’t use it directly.

GLogWriterOutput wp_log_writer_default(GLogLevelFlags log_level_flags, 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_checked(const gchar *log_topic, GLogLevelFlags log_level_flags, 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.

This assumes that the arguments are correct and that the log_topic is enabled for the given log_level. No additional checks are performed.

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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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_notice(...) wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_MESSAGE, 0, NULL, __VA_ARGS__)

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

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

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

Logs a notice 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_notice_boxed(type, object, ...) wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_MESSAGE, type, object, __VA_ARGS__)

Logs a notice 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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 (WP_LOCAL_LOG_TOPIC, 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_LOCAL_LOG_TOPIC, 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_LOCAL_LOG_TOPIC, 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_LOCAL_LOG_TOPIC, 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(topic, level, type, object, ...)

({ \

if (G_UNLIKELY (wp_log_topic_is_enabled (topic, level))) \

wp_log_checked

(topic->topic_name, 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