log: fix WP_LOG_LEVEL_TRACE value in the g-i bindings

See #540
This commit is contained in:
George Kiagiadakis
2024-03-09 17:23:32 +02:00
parent f4d8fa94d7
commit b106b774f8
2 changed files with 15 additions and 5 deletions

View File

@@ -17,10 +17,6 @@ WP_DEFINE_LOCAL_LOG_TOPIC ("wp-log")
* \defgroup wplog Debug Logging
* \{
*/
/*!
* \def WP_LOG_LEVEL_TRACE
* \brief A custom GLib log level for trace messages (see GLogLevelFlags)
*/
/*!
* \def WP_OBJECT_FORMAT
* \brief A format string to print GObjects with WP_OBJECT_ARGS()

View File

@@ -14,7 +14,21 @@
G_BEGIN_DECLS
#define WP_LOG_LEVEL_TRACE (1 << G_LOG_LEVEL_USER_SHIFT)
/*!
* \brief A custom GLib log level for trace messages (extension of GLogLevelFlags)
* \ingroup wplog
*/
static const guint WP_LOG_LEVEL_TRACE = (1 << 8);
/*
The above WP_LOG_LEVEL_TRACE constant is intended to be defined as
(1 << G_LOG_LEVEL_USER_SHIFT), but due to a gobject-introspection bug
we define it with the value of G_LOG_LEVEL_USER_SHIFT, which is 8, so
that it ends up correctly in the bindings. To avoid value mismatches,
we statically verify here that G_LOG_LEVEL_USER_SHIFT is indeed 8.
See https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/540
*/
G_STATIC_ASSERT (G_LOG_LEVEL_USER_SHIFT == 8);
#define WP_OBJECT_FORMAT "<%s:%p>"
#define WP_OBJECT_ARGS(object) \