Debug Logging

Functions

wp_log_level_is_enabled

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


wp_log_set_level

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"


wp_log_structured_standard

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.

Parameters:

log_domain
No description available
log_level
No description available
file
No description available
line
No description available
func
No description available
object_type
No description available
object
No description available
message_format
No description available
...
No description available

wp_log_writer_default

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

Parameters:

log_level
No description available
fields
No description available
n_fields
No description available
user_data
No description available
Returns
No description available

wp_spa_log_get_instance

spa_log*
wp_spa_log_get_instance ()
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


Function Macros

WP_OBJECT_ARGS

#define WP_OBJECT_ARGS(object) \
    (object ? G_OBJECT_TYPE_NAME(object) : "invalid"), object

wp_critical

#define wp_critical(...) \
    wp_log (G_LOG_LEVEL_CRITICAL, 0, NULL, __VA_ARGS__)

wp_critical_boxed

#define wp_critical_boxed(type, object, ...) \
    wp_log (G_LOG_LEVEL_CRITICAL, type, object, __VA_ARGS__)

wp_critical_object

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

wp_debug

#define wp_debug(...) \
    wp_log (G_LOG_LEVEL_DEBUG, 0, NULL, __VA_ARGS__)

wp_debug_boxed

#define wp_debug_boxed(type, object, ...) \
    wp_log (G_LOG_LEVEL_DEBUG, type, object, __VA_ARGS__)

wp_debug_object

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

wp_info

#define wp_info(...) \
    wp_log (G_LOG_LEVEL_INFO, 0, NULL, __VA_ARGS__)

wp_info_boxed

#define wp_info_boxed(type, object, ...) \
    wp_log (G_LOG_LEVEL_INFO, type, object, __VA_ARGS__)

wp_info_object

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

wp_log

#define 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__); \
})

wp_message

#define wp_message(...) \
    wp_log (G_LOG_LEVEL_MESSAGE, 0, NULL, __VA_ARGS__)

wp_message_boxed

#define wp_message_boxed(type, object, ...) \
    wp_log (G_LOG_LEVEL_MESSAGE, type, object, __VA_ARGS__)

wp_message_object

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

wp_trace

#define wp_trace(...) \
    wp_log (WP_LOG_LEVEL_TRACE, 0, NULL, __VA_ARGS__)

wp_trace_boxed

#define wp_trace_boxed(type, object, ...) \
    wp_log (WP_LOG_LEVEL_TRACE, type, object, __VA_ARGS__)

wp_trace_object

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

wp_warning

#define wp_warning(...) \
    wp_log (G_LOG_LEVEL_WARNING, 0, NULL, __VA_ARGS__)

wp_warning_boxed

#define wp_warning_boxed(type, object, ...) \
    wp_log (G_LOG_LEVEL_WARNING, type, object, __VA_ARGS__)

wp_warning_object

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

Constants

WP_LOG_LEVEL_TRACE

#define WP_LOG_LEVEL_TRACE (1 << G_LOG_LEVEL_USER_SHIFT)

WP_OBJECT_FORMAT

#define WP_OBJECT_FORMAT "<%s:%p>"

The results of the search are