log: implement a log topics system, like pipewire
The intention is to make checks for enabled log topics faster. Every topic has its own structure that is statically defined in the file where the logs are printed from. The structure is initialized transparently when it is first used and it contains all the log level flags for the levels that this topic should print messages. It is then checked on the wp_log() macro before printing the message. Topics from SPA/PipeWire are also handled natively, so messages are printed directly without checking if the topic is enabled, since the PipeWire and SPA macros do the checking themselves. Messages coming from GLib are checked inside the handler. An internal WpLogFields object is used to manage the state of each log message, populating all the fields appropriately from the place they are coming from (wp_log, spa_log, glib log), formatting the message and then printing it. For printing to the journald, we still use the glib message handler, converting all the needed fields to GLogField on demand. That message handler does not do any checks for the topic or the level, so we can just call it to send the message.
This commit is contained in:
@@ -6,11 +6,12 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-client"
|
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "log.h"
|
||||||
#include "private/pipewire-object-mixin.h"
|
#include "private/pipewire-object-mixin.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-client")
|
||||||
|
|
||||||
/*! \defgroup wpclient WpClient */
|
/*! \defgroup wpclient WpClient */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpClient
|
* \struct WpClient
|
||||||
|
@@ -6,13 +6,13 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-comp-loader"
|
|
||||||
|
|
||||||
#include "component-loader.h"
|
#include "component-loader.h"
|
||||||
#include "wp.h"
|
#include "wp.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
#include <pipewire/impl.h>
|
#include <pipewire/impl.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-comp-loader")
|
||||||
|
|
||||||
/*! \defgroup wpcomponentloader WpComponentLoader */
|
/*! \defgroup wpcomponentloader WpComponentLoader */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpComponentLoader
|
* \struct WpComponentLoader
|
||||||
|
@@ -6,15 +6,16 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-conf"
|
|
||||||
#define OVERRIDE_SECTION_PREFIX "override."
|
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "object-interest.h"
|
#include "object-interest.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-conf")
|
||||||
|
|
||||||
|
#define OVERRIDE_SECTION_PREFIX "override."
|
||||||
|
|
||||||
/*! \defgroup wpconf WpConf */
|
/*! \defgroup wpconf WpConf */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpConf
|
* \struct WpConf
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-core"
|
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "wp.h"
|
#include "wp.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
@@ -18,6 +16,8 @@
|
|||||||
#include <spa/debug/types.h>
|
#include <spa/debug/types.h>
|
||||||
#include <spa/support/cpu.h>
|
#include <spa/support/cpu.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-core")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Integration between the PipeWire main loop and GMainLoop
|
* Integration between the PipeWire main loop and GMainLoop
|
||||||
*/
|
*/
|
||||||
|
@@ -6,13 +6,13 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-dbus"
|
|
||||||
|
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "wpenums.h"
|
#include "wpenums.h"
|
||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-dbus")
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STEP_DBUS_ENABLE = WP_TRANSITION_STEP_CUSTOM_START,
|
STEP_DBUS_ENABLE = WP_TRANSITION_STEP_CUSTOM_START,
|
||||||
};
|
};
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-device"
|
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
@@ -20,6 +18,8 @@
|
|||||||
#include <spa/monitor/device.h>
|
#include <spa/monitor/device.h>
|
||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-device")
|
||||||
|
|
||||||
/*! \defgroup wpdevice WpDevice */
|
/*! \defgroup wpdevice WpDevice */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpDevice
|
* \struct WpDevice
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-event-dispatcher"
|
|
||||||
|
|
||||||
#include "event-dispatcher.h"
|
#include "event-dispatcher.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -15,6 +13,8 @@
|
|||||||
#include <spa/support/plugin.h>
|
#include <spa/support/plugin.h>
|
||||||
#include <spa/support/system.h>
|
#include <spa/support/system.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-event-dispatcher")
|
||||||
|
|
||||||
typedef struct _EventData EventData;
|
typedef struct _EventData EventData;
|
||||||
struct _EventData
|
struct _EventData
|
||||||
{
|
{
|
||||||
|
@@ -6,14 +6,14 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-event-hook"
|
|
||||||
|
|
||||||
#include "event-hook.h"
|
#include "event-hook.h"
|
||||||
#include "event-dispatcher.h"
|
#include "event-dispatcher.h"
|
||||||
#include "transition.h"
|
#include "transition.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "wpenums.h"
|
#include "wpenums.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-event-hook")
|
||||||
|
|
||||||
typedef struct _WpEventHookPrivate WpEventHookPrivate;
|
typedef struct _WpEventHookPrivate WpEventHookPrivate;
|
||||||
struct _WpEventHookPrivate
|
struct _WpEventHookPrivate
|
||||||
{
|
{
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-event"
|
|
||||||
|
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "event-dispatcher.h"
|
#include "event-dispatcher.h"
|
||||||
#include "event-hook.h"
|
#include "event-hook.h"
|
||||||
@@ -17,6 +15,8 @@
|
|||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
#include <spa/utils/list.h>
|
#include <spa/utils/list.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-event")
|
||||||
|
|
||||||
typedef struct _HookData HookData;
|
typedef struct _HookData HookData;
|
||||||
struct _HookData
|
struct _HookData
|
||||||
{
|
{
|
||||||
|
@@ -6,12 +6,11 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-factory"
|
|
||||||
|
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
|
#include "log.h"
|
||||||
#include "private/pipewire-object-mixin.h"
|
#include "private/pipewire-object-mixin.h"
|
||||||
|
|
||||||
#include "log.h"
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-factory")
|
||||||
|
|
||||||
/*! \defgroup wpfactory WpFactory */
|
/*! \defgroup wpfactory WpFactory */
|
||||||
/*!
|
/*!
|
||||||
|
@@ -6,12 +6,13 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-global-proxy"
|
|
||||||
|
|
||||||
#include "global-proxy.h"
|
#include "global-proxy.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-global-proxy")
|
||||||
|
|
||||||
/*! \defgroup wpglobalproxy WpGlobalProxy */
|
/*! \defgroup wpglobalproxy WpGlobalProxy */
|
||||||
/*!
|
/*!
|
||||||
|
@@ -6,11 +6,12 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-iterator"
|
|
||||||
|
|
||||||
#include "iterator.h"
|
#include "iterator.h"
|
||||||
|
#include "log.h"
|
||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-iterator")
|
||||||
|
|
||||||
/*! \defgroup wpiterator WpIterator */
|
/*! \defgroup wpiterator WpIterator */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpIterator
|
* \struct WpIterator
|
||||||
|
@@ -6,12 +6,13 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-link"
|
|
||||||
|
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
|
#include "log.h"
|
||||||
#include "wpenums.h"
|
#include "wpenums.h"
|
||||||
#include "private/pipewire-object-mixin.h"
|
#include "private/pipewire-object-mixin.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-link")
|
||||||
|
|
||||||
/*! \defgroup wplink WpLink */
|
/*! \defgroup wplink WpLink */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpLink
|
* \struct WpLink
|
||||||
|
422
lib/wp/log.c
422
lib/wp/log.c
@@ -12,6 +12,8 @@
|
|||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <spa/support/log.h>
|
#include <spa/support/log.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-log")
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \defgroup wplog Debug Logging
|
* \defgroup wplog Debug Logging
|
||||||
* \{
|
* \{
|
||||||
@@ -188,19 +190,6 @@ struct log_topic_pattern
|
|||||||
static struct log_topic_pattern *patterns = NULL;
|
static struct log_topic_pattern *patterns = NULL;
|
||||||
static gint global_log_level = 4; /* MESSAGE */
|
static gint global_log_level = 4; /* MESSAGE */
|
||||||
|
|
||||||
struct common_fields
|
|
||||||
{
|
|
||||||
const gchar *log_domain;
|
|
||||||
const gchar *file;
|
|
||||||
const gchar *line;
|
|
||||||
const gchar *func;
|
|
||||||
const gchar *message;
|
|
||||||
GLogField *message_field;
|
|
||||||
gint log_level;
|
|
||||||
GType object_type;
|
|
||||||
gconstpointer object;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* reference: https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit */
|
/* reference: https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit */
|
||||||
#define COLOR_RED "\033[1;31m"
|
#define COLOR_RED "\033[1;31m"
|
||||||
#define COLOR_GREEN "\033[1;32m"
|
#define COLOR_GREEN "\033[1;32m"
|
||||||
@@ -233,7 +222,7 @@ static const gchar *object_colors[] = {
|
|||||||
* reference: http://man7.org/linux/man-pages/man3/syslog.3.html#DESCRIPTION
|
* reference: http://man7.org/linux/man-pages/man3/syslog.3.html#DESCRIPTION
|
||||||
*/
|
*/
|
||||||
static const struct {
|
static const struct {
|
||||||
GLogLevelFlags log_level;
|
GLogLevelFlags log_level_flags;
|
||||||
enum spa_log_level spa_level;
|
enum spa_log_level spa_level;
|
||||||
gchar name[6];
|
gchar name[6];
|
||||||
gchar priority[2];
|
gchar priority[2];
|
||||||
@@ -284,119 +273,6 @@ level_index_to_spa (gint lvl_index)
|
|||||||
return log_level_info [lvl_index].spa_level;
|
return log_level_info [lvl_index].spa_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
write_debug_message (FILE *s, struct common_fields *cf)
|
|
||||||
{
|
|
||||||
gint64 now;
|
|
||||||
time_t now_secs;
|
|
||||||
struct tm now_tm;
|
|
||||||
gchar time_buf[128];
|
|
||||||
|
|
||||||
now = g_get_real_time ();
|
|
||||||
now_secs = (time_t) (now / G_USEC_PER_SEC);
|
|
||||||
localtime_r (&now_secs, &now_tm);
|
|
||||||
strftime (time_buf, sizeof (time_buf), "%H:%M:%S", &now_tm);
|
|
||||||
|
|
||||||
fprintf (s, "%s%s %s.%06d %s%18.18s %s%s:%s:%s:%s %s\n",
|
|
||||||
/* level */
|
|
||||||
use_color ? log_level_info[cf->log_level].color : "",
|
|
||||||
log_level_info[cf->log_level].name,
|
|
||||||
/* timestamp */
|
|
||||||
time_buf,
|
|
||||||
(gint) (now % G_USEC_PER_SEC),
|
|
||||||
/* domain */
|
|
||||||
use_color ? DOMAIN_COLOR : "",
|
|
||||||
cf->log_domain,
|
|
||||||
/* file, line, function */
|
|
||||||
use_color ? LOCATION_COLOR : "",
|
|
||||||
cf->file,
|
|
||||||
cf->line,
|
|
||||||
cf->func,
|
|
||||||
use_color ? RESET_COLOR : "",
|
|
||||||
/* message */
|
|
||||||
cf->message);
|
|
||||||
fflush (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gchar *
|
|
||||||
format_message (struct common_fields *cf)
|
|
||||||
{
|
|
||||||
g_autofree gchar *extra_message = NULL;
|
|
||||||
g_autofree gchar *extra_object = NULL;
|
|
||||||
const gchar *object_color = "";
|
|
||||||
|
|
||||||
if (use_color) {
|
|
||||||
guint h = g_direct_hash (cf->object) % G_N_ELEMENTS (object_colors);
|
|
||||||
object_color = object_colors[h];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cf->object_type == WP_TYPE_SPA_POD && cf->object && !spa_dbg_str) {
|
|
||||||
spa_dbg_str = g_string_new (cf->message);
|
|
||||||
g_string_append (spa_dbg_str, ":\n");
|
|
||||||
spa_debug_pod (2, NULL, wp_spa_pod_get_spa_pod (cf->object));
|
|
||||||
extra_message = g_string_free (spa_dbg_str, FALSE);
|
|
||||||
spa_dbg_str = NULL;
|
|
||||||
}
|
|
||||||
else if (cf->object && g_type_is_a (cf->object_type, WP_TYPE_PROXY) &&
|
|
||||||
(wp_object_get_active_features ((WpObject *) cf->object) & WP_PROXY_FEATURE_BOUND)) {
|
|
||||||
extra_object = g_strdup_printf (":%u:",
|
|
||||||
wp_proxy_get_bound_id ((WpProxy *) cf->object));
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_strdup_printf ("%s<%s%s%p>%s %s",
|
|
||||||
object_color,
|
|
||||||
cf->object_type != 0 ? g_type_name (cf->object_type) : "",
|
|
||||||
extra_object ? extra_object : ":",
|
|
||||||
cf->object,
|
|
||||||
use_color ? RESET_COLOR : "",
|
|
||||||
extra_message ? extra_message : cf->message);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
extract_common_fields (struct common_fields *cf, const GLogField *fields,
|
|
||||||
gsize n_fields)
|
|
||||||
{
|
|
||||||
for (guint i = 0; i < n_fields; i++) {
|
|
||||||
if (g_strcmp0 (fields[i].key, "GLIB_DOMAIN") == 0) {
|
|
||||||
cf->log_domain = fields[i].value;
|
|
||||||
}
|
|
||||||
else if (g_strcmp0 (fields[i].key, "MESSAGE") == 0) {
|
|
||||||
cf->message = fields[i].value;
|
|
||||||
cf->message_field = (GLogField *) &fields[i];
|
|
||||||
}
|
|
||||||
else if (g_strcmp0 (fields[i].key, "CODE_FILE") == 0) {
|
|
||||||
cf->file = fields[i].value;
|
|
||||||
}
|
|
||||||
else if (g_strcmp0 (fields[i].key, "CODE_LINE") == 0) {
|
|
||||||
cf->line = fields[i].value;
|
|
||||||
}
|
|
||||||
else if (g_strcmp0 (fields[i].key, "CODE_FUNC") == 0) {
|
|
||||||
cf->func = fields[i].value;
|
|
||||||
}
|
|
||||||
else if (g_strcmp0 (fields[i].key, "WP_OBJECT_TYPE") == 0 &&
|
|
||||||
fields[i].length == sizeof (GType)) {
|
|
||||||
cf->object_type = *((GType *) fields[i].value);
|
|
||||||
}
|
|
||||||
else if (g_strcmp0 (fields[i].key, "WP_OBJECT") == 0 &&
|
|
||||||
fields[i].length == sizeof (gconstpointer)) {
|
|
||||||
cf->object = *((gconstpointer *) fields[i].value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief 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
|
|
||||||
* \ingroup wplog
|
|
||||||
* \param log_level a log level
|
|
||||||
* \returns whether the log level is currently enabled
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
wp_log_level_is_enabled (GLogLevelFlags log_level)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
level_index_from_string (const char *str)
|
level_index_from_string (const char *str)
|
||||||
{
|
{
|
||||||
@@ -502,21 +378,174 @@ find_topic_log_level (const gchar *log_topic, bool *has_custom_level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief WirePlumber's GLogWriterFunc
|
* \brief Initializes a log topic. Internal function, don't use it directly
|
||||||
*
|
|
||||||
* This is installed automatically when you call wp_init() with
|
|
||||||
* WP_INIT_SET_GLIB_LOG set in the flags
|
|
||||||
* \ingroup wplog
|
* \ingroup wplog
|
||||||
*/
|
*/
|
||||||
GLogWriterOutput
|
void
|
||||||
wp_log_writer_default (GLogLevelFlags log_level,
|
wp_log_topic_init (WpLogTopic *topic)
|
||||||
const GLogField *fields, gsize n_fields, gpointer user_data)
|
|
||||||
{
|
{
|
||||||
struct common_fields cf = {0};
|
g_bit_lock (&topic->flags, 30);
|
||||||
g_autofree gchar *full_message = NULL;
|
if ((topic->flags & (1u << 31)) == 0) {
|
||||||
|
gint log_level = find_topic_log_level (topic->topic_name, NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (fields != NULL, G_LOG_WRITER_UNHANDLED);
|
/* write all the enabled log level flags on the flags variable */
|
||||||
g_return_val_if_fail (n_fields > 0, G_LOG_WRITER_UNHANDLED);
|
for (gint i = 1; i <= log_level; i++) {
|
||||||
|
topic->flags |= log_level_info[i].log_level_flags;
|
||||||
|
}
|
||||||
|
topic->flags |= (1u << 31);
|
||||||
|
}
|
||||||
|
g_bit_unlock (&topic->flags, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct _WpLogFields WpLogFields;
|
||||||
|
struct _WpLogFields
|
||||||
|
{
|
||||||
|
const gchar *log_topic;
|
||||||
|
const gchar *file;
|
||||||
|
const gchar *line;
|
||||||
|
const gchar *func;
|
||||||
|
const gchar *message;
|
||||||
|
gint log_level;
|
||||||
|
GType object_type;
|
||||||
|
gconstpointer object;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
wp_log_fields_init (WpLogFields *lf,
|
||||||
|
const gchar *log_topic,
|
||||||
|
gint log_level,
|
||||||
|
const gchar *file,
|
||||||
|
const gchar *line,
|
||||||
|
const gchar *func,
|
||||||
|
GType object_type,
|
||||||
|
gconstpointer object,
|
||||||
|
const gchar *message)
|
||||||
|
{
|
||||||
|
lf->log_topic = log_topic ? log_topic : "default";
|
||||||
|
lf->log_level = log_level;
|
||||||
|
lf->file = file;
|
||||||
|
lf->line = line;
|
||||||
|
lf->func = func;
|
||||||
|
lf->object_type = object_type;
|
||||||
|
lf->object = object;
|
||||||
|
lf->message = message ? message : "(null)";
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wp_log_fields_init_from_glib (WpLogFields *lf, GLogLevelFlags log_level_flags,
|
||||||
|
const GLogField *fields, gsize n_fields)
|
||||||
|
{
|
||||||
|
wp_log_fields_init (lf, NULL, log_level_index (log_level_flags),
|
||||||
|
NULL, NULL, NULL, 0, NULL, NULL);
|
||||||
|
|
||||||
|
for (guint i = 0; i < n_fields; i++) {
|
||||||
|
if (g_strcmp0 (fields[i].key, "GLIB_DOMAIN") == 0 && fields[i].value) {
|
||||||
|
lf->log_topic = fields[i].value;
|
||||||
|
}
|
||||||
|
else if (g_strcmp0 (fields[i].key, "MESSAGE") == 0 && fields[i].value) {
|
||||||
|
lf->message = fields[i].value;
|
||||||
|
}
|
||||||
|
else if (g_strcmp0 (fields[i].key, "CODE_FILE") == 0) {
|
||||||
|
lf->file = fields[i].value;
|
||||||
|
}
|
||||||
|
else if (g_strcmp0 (fields[i].key, "CODE_LINE") == 0) {
|
||||||
|
lf->line = fields[i].value;
|
||||||
|
}
|
||||||
|
else if (g_strcmp0 (fields[i].key, "CODE_FUNC") == 0) {
|
||||||
|
lf->func = fields[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
wp_log_fields_write_to_stream (WpLogFields *lf, FILE *s)
|
||||||
|
{
|
||||||
|
gint64 now;
|
||||||
|
time_t now_secs;
|
||||||
|
struct tm now_tm;
|
||||||
|
gchar time_buf[128];
|
||||||
|
|
||||||
|
now = g_get_real_time ();
|
||||||
|
now_secs = (time_t) (now / G_USEC_PER_SEC);
|
||||||
|
localtime_r (&now_secs, &now_tm);
|
||||||
|
strftime (time_buf, sizeof (time_buf), "%H:%M:%S", &now_tm);
|
||||||
|
|
||||||
|
fprintf (s, "%s%s %s.%06d %s%18.18s %s%s:%s:%s:%s %s\n",
|
||||||
|
/* level */
|
||||||
|
use_color ? log_level_info[lf->log_level].color : "",
|
||||||
|
log_level_info[lf->log_level].name,
|
||||||
|
/* timestamp */
|
||||||
|
time_buf,
|
||||||
|
(gint) (now % G_USEC_PER_SEC),
|
||||||
|
/* domain */
|
||||||
|
use_color ? DOMAIN_COLOR : "",
|
||||||
|
lf->log_topic,
|
||||||
|
/* file, line, function */
|
||||||
|
use_color ? LOCATION_COLOR : "",
|
||||||
|
lf->file,
|
||||||
|
lf->line,
|
||||||
|
lf->func,
|
||||||
|
use_color ? RESET_COLOR : "",
|
||||||
|
/* message */
|
||||||
|
lf->message);
|
||||||
|
fflush (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
wp_log_fields_write_to_journal (WpLogFields *lf)
|
||||||
|
{
|
||||||
|
gsize n_fields = 6;
|
||||||
|
GLogField fields[6] = {
|
||||||
|
{ "PRIORITY", log_level_info[lf->log_level].priority, -1 },
|
||||||
|
{ "CODE_FILE", lf->file, -1 },
|
||||||
|
{ "CODE_LINE", lf->line, -1 },
|
||||||
|
{ "CODE_FUNC", lf->func, -1 },
|
||||||
|
{ "TOPIC", lf->log_topic, -1 },
|
||||||
|
{ "MESSAGE", lf->message, -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* the log level flags are not used in this function, so we can pass 0 */
|
||||||
|
return (g_log_writer_journald (0, fields, n_fields, NULL) == G_LOG_WRITER_HANDLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gchar *
|
||||||
|
wp_log_fields_format_message (WpLogFields *lf)
|
||||||
|
{
|
||||||
|
g_autofree gchar *extra_message = NULL;
|
||||||
|
g_autofree gchar *extra_object = NULL;
|
||||||
|
const gchar *object_color = "";
|
||||||
|
|
||||||
|
if (use_color) {
|
||||||
|
guint h = g_direct_hash (lf->object) % G_N_ELEMENTS (object_colors);
|
||||||
|
object_color = object_colors[h];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lf->object_type == WP_TYPE_SPA_POD && lf->object && !spa_dbg_str) {
|
||||||
|
spa_dbg_str = g_string_new (lf->message);
|
||||||
|
g_string_append (spa_dbg_str, ":\n");
|
||||||
|
spa_debug_pod (2, NULL, wp_spa_pod_get_spa_pod (lf->object));
|
||||||
|
extra_message = g_string_free (spa_dbg_str, FALSE);
|
||||||
|
spa_dbg_str = NULL;
|
||||||
|
}
|
||||||
|
else if (lf->object && g_type_is_a (lf->object_type, WP_TYPE_PROXY) &&
|
||||||
|
(wp_object_get_active_features ((WpObject *) lf->object) & WP_PROXY_FEATURE_BOUND)) {
|
||||||
|
extra_object = g_strdup_printf (":%u:",
|
||||||
|
wp_proxy_get_bound_id ((WpProxy *) lf->object));
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_strdup_printf ("%s<%s%s%p>%s %s",
|
||||||
|
object_color,
|
||||||
|
lf->object_type != 0 ? g_type_name (lf->object_type) : "",
|
||||||
|
extra_object ? extra_object : ":",
|
||||||
|
lf->object,
|
||||||
|
use_color ? RESET_COLOR : "",
|
||||||
|
extra_message ? extra_message : lf->message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLogWriterOutput
|
||||||
|
wp_log_fields_log (WpLogFields *lf)
|
||||||
|
{
|
||||||
|
g_autofree gchar *full_message = NULL;
|
||||||
|
|
||||||
/* in the unlikely event that someone messed with stderr... */
|
/* in the unlikely event that someone messed with stderr... */
|
||||||
if (G_UNLIKELY (!stderr || fileno (stderr) < 0))
|
if (G_UNLIKELY (!stderr || fileno (stderr) < 0))
|
||||||
@@ -529,43 +558,55 @@ wp_log_writer_default (GLogLevelFlags log_level,
|
|||||||
g_once_init_leave (&initialized, TRUE);
|
g_once_init_leave (&initialized, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cf.log_level = log_level_index (log_level);
|
|
||||||
|
|
||||||
extract_common_fields (&cf, fields, n_fields);
|
|
||||||
|
|
||||||
if (!cf.log_domain)
|
|
||||||
cf.log_domain = "default";
|
|
||||||
|
|
||||||
/* check if debug level & topic is enabled */
|
|
||||||
if (cf.log_level > find_topic_log_level (cf.log_domain, NULL))
|
|
||||||
return G_LOG_WRITER_UNHANDLED;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!cf.message))
|
|
||||||
cf.message_field->value = cf.message = "(null)";
|
|
||||||
|
|
||||||
/* format the message to include the object */
|
/* format the message to include the object */
|
||||||
if (cf.object_type) {
|
if (lf->object_type) {
|
||||||
cf.message_field->value = cf.message = full_message =
|
lf->message = full_message = wp_log_fields_format_message (lf);
|
||||||
format_message (&cf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write complete field information to the journal if we are logging to it */
|
/* write complete field information to the journal if we are logging to it */
|
||||||
if (output_is_journal &&
|
if (output_is_journal && wp_log_fields_write_to_journal (lf))
|
||||||
g_log_writer_journald (log_level, fields, n_fields, user_data) == G_LOG_WRITER_HANDLED)
|
|
||||||
return G_LOG_WRITER_HANDLED;
|
return G_LOG_WRITER_HANDLED;
|
||||||
|
|
||||||
write_debug_message (stderr, &cf);
|
wp_log_fields_write_to_stream (lf, stderr);
|
||||||
return G_LOG_WRITER_HANDLED;
|
return G_LOG_WRITER_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief WirePlumber's GLogWriterFunc
|
||||||
|
*
|
||||||
|
* This is installed automatically when you call wp_init() with
|
||||||
|
* WP_INIT_SET_GLIB_LOG set in the flags
|
||||||
|
* \ingroup wplog
|
||||||
|
*/
|
||||||
|
GLogWriterOutput
|
||||||
|
wp_log_writer_default (GLogLevelFlags log_level_flags,
|
||||||
|
const GLogField *fields, gsize n_fields, gpointer user_data)
|
||||||
|
{
|
||||||
|
WpLogFields lf = {0};
|
||||||
|
|
||||||
|
g_return_val_if_fail (fields != NULL, G_LOG_WRITER_UNHANDLED);
|
||||||
|
g_return_val_if_fail (n_fields > 0, G_LOG_WRITER_UNHANDLED);
|
||||||
|
|
||||||
|
wp_log_fields_init_from_glib (&lf, log_level_flags, fields, n_fields);
|
||||||
|
|
||||||
|
/* check if debug level & topic is enabled */
|
||||||
|
if (lf.log_level > find_topic_log_level (lf.log_topic, NULL))
|
||||||
|
return G_LOG_WRITER_HANDLED;
|
||||||
|
|
||||||
|
return wp_log_fields_log (&lf);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Used internally by the debug logging macros. Avoid using it directly.
|
* \brief 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.
|
||||||
* \ingroup wplog
|
* \ingroup wplog
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
wp_log_structured_standard (
|
wp_log_checked (
|
||||||
const gchar *log_domain,
|
const gchar *log_topic,
|
||||||
GLogLevelFlags log_level,
|
GLogLevelFlags log_level_flags,
|
||||||
const gchar *file,
|
const gchar *file,
|
||||||
const gchar *line,
|
const gchar *line,
|
||||||
const gchar *func,
|
const gchar *func,
|
||||||
@@ -574,43 +615,17 @@ wp_log_structured_standard (
|
|||||||
const gchar *message_format,
|
const gchar *message_format,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
|
WpLogFields lf = {0};
|
||||||
g_autofree gchar *message = NULL;
|
g_autofree gchar *message = NULL;
|
||||||
GLogField fields[8] = {
|
|
||||||
{ "PRIORITY", log_level_info[log_level_index (log_level)].priority, -1 },
|
|
||||||
{ "CODE_FILE", file, -1 },
|
|
||||||
{ "CODE_LINE", line, -1 },
|
|
||||||
{ "CODE_FUNC", func, -1 },
|
|
||||||
{ "MESSAGE", NULL, -1 },
|
|
||||||
};
|
|
||||||
gsize n_fields = 5;
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (log_domain != NULL) {
|
|
||||||
fields[n_fields].key = "GLIB_DOMAIN";
|
|
||||||
fields[n_fields].value = log_domain;
|
|
||||||
fields[n_fields].length = -1;
|
|
||||||
n_fields++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object_type != 0) {
|
|
||||||
fields[n_fields].key = "WP_OBJECT_TYPE";
|
|
||||||
fields[n_fields].value = &object_type;
|
|
||||||
fields[n_fields].length = sizeof (GType);
|
|
||||||
n_fields++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object != NULL) {
|
|
||||||
fields[n_fields].key = "WP_OBJECT";
|
|
||||||
fields[n_fields].value = &object;
|
|
||||||
fields[n_fields].length = sizeof (gconstpointer);
|
|
||||||
n_fields++;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start (args, message_format);
|
va_start (args, message_format);
|
||||||
fields[4].value = message = g_strdup_vprintf (message_format, args);
|
message = g_strdup_vprintf (message_format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
g_log_structured_array (log_level, fields, n_fields);
|
wp_log_fields_init (&lf, log_topic, log_level_index (log_level_flags),
|
||||||
|
file, line, func, object_type, object, message);
|
||||||
|
wp_log_fields_log (&lf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static G_GNUC_PRINTF (7, 0) void
|
static G_GNUC_PRINTF (7, 0) void
|
||||||
@@ -623,28 +638,17 @@ wp_spa_log_logtv (void *object,
|
|||||||
const char *fmt,
|
const char *fmt,
|
||||||
va_list args)
|
va_list args)
|
||||||
{
|
{
|
||||||
|
WpLogFields lf = {0};
|
||||||
|
gint log_level = level_index_from_spa (level);
|
||||||
g_autofree gchar *message = NULL;
|
g_autofree gchar *message = NULL;
|
||||||
gchar line_str[11];
|
gchar line_str[11];
|
||||||
GLogField fields[] = {
|
|
||||||
{ "PRIORITY", NULL, -1 },
|
|
||||||
{ "CODE_FILE", file, -1 },
|
|
||||||
{ "CODE_LINE", line_str, -1 },
|
|
||||||
{ "CODE_FUNC", func, -1 },
|
|
||||||
{ "MESSAGE", NULL, -1 },
|
|
||||||
{ "GLIB_DOMAIN", "pw", -1 },
|
|
||||||
};
|
|
||||||
|
|
||||||
gint log_level_idx = level_index_from_spa (level);
|
|
||||||
GLogLevelFlags log_level = log_level_info[log_level_idx].log_level;
|
|
||||||
fields[0].value = log_level_info[log_level_idx].priority;
|
|
||||||
|
|
||||||
sprintf (line_str, "%d", line);
|
sprintf (line_str, "%d", line);
|
||||||
fields[4].value = message = g_strdup_vprintf (fmt, args);
|
message = g_strdup_vprintf (fmt, args);
|
||||||
|
|
||||||
if (topic)
|
wp_log_fields_init (&lf, topic ? topic->topic : NULL, log_level,
|
||||||
fields[5].value = topic->topic;
|
file, line_str, func, 0, NULL, message);
|
||||||
|
wp_log_fields_log (&lf);
|
||||||
g_log_structured_array (log_level, fields, SPA_N_ELEMENTS (fields));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static G_GNUC_PRINTF (7, 8) void
|
static G_GNUC_PRINTF (7, 8) void
|
||||||
|
99
lib/wp/log.h
99
lib/wp/log.h
@@ -20,8 +20,55 @@ G_BEGIN_DECLS
|
|||||||
#define WP_OBJECT_ARGS(object) \
|
#define WP_OBJECT_ARGS(object) \
|
||||||
(object ? G_OBJECT_TYPE_NAME(object) : "invalid"), object
|
(object ? G_OBJECT_TYPE_NAME(object) : "invalid"), object
|
||||||
|
|
||||||
|
typedef struct _WpLogTopic WpLogTopic;
|
||||||
|
struct _WpLogTopic {
|
||||||
|
const char *topic_name;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
/*
|
||||||
|
* lower 16 bits: GLogLevelFlags
|
||||||
|
* bit 30: a g_bit_lock
|
||||||
|
* bit 31: 1 - initialized, 0 - not initialized
|
||||||
|
*/
|
||||||
|
gint flags;
|
||||||
|
WP_PADDING(2)
|
||||||
|
};
|
||||||
|
|
||||||
|
#define WP_LOG_TOPIC_EXTERN(var) \
|
||||||
|
extern WpLogTopic * var;
|
||||||
|
|
||||||
|
#define WP_LOG_TOPIC(var, t) \
|
||||||
|
WpLogTopic var##_struct = { .topic_name = t, .flags = 0 }; \
|
||||||
|
WpLogTopic * var = &(var##_struct);
|
||||||
|
|
||||||
|
#define WP_LOG_TOPIC_STATIC(var, t) \
|
||||||
|
static WpLogTopic var##_struct = { .topic_name = t, .flags = 0 }; \
|
||||||
|
static G_GNUC_UNUSED WpLogTopic * var = &(var##_struct);
|
||||||
|
|
||||||
|
#define WP_DEFINE_LOCAL_LOG_TOPIC(t) \
|
||||||
|
WP_LOG_TOPIC_STATIC(WP_LOCAL_LOG_TOPIC, t)
|
||||||
|
|
||||||
|
/* make glib log functions also use the local log topic */
|
||||||
|
#ifdef G_LOG_DOMAIN
|
||||||
|
# undef G_LOG_DOMAIN
|
||||||
|
#endif
|
||||||
|
#define G_LOG_DOMAIN (WP_LOCAL_LOG_TOPIC->topic_name)
|
||||||
|
|
||||||
WP_API
|
WP_API
|
||||||
gboolean wp_log_level_is_enabled (GLogLevelFlags log_level) G_GNUC_PURE;
|
void wp_log_topic_init (WpLogTopic *topic);
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
wp_log_topic_is_enabled (WpLogTopic *topic, GLogLevelFlags log_level)
|
||||||
|
{
|
||||||
|
/* first time initialization */
|
||||||
|
if (G_UNLIKELY ((topic->flags & (1u << 31)) == 0)) {
|
||||||
|
wp_log_topic_init (topic);
|
||||||
|
}
|
||||||
|
return (topic->flags & (log_level & 0xFF)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wp_local_log_topic_is_enabled(log_level) \
|
||||||
|
(wp_log_topic_is_enabled (WP_LOCAL_LOG_TOPIC, log_level))
|
||||||
|
|
||||||
WP_API
|
WP_API
|
||||||
void wp_log_set_level (const gchar * level_str);
|
void wp_log_set_level (const gchar * level_str);
|
||||||
@@ -31,56 +78,56 @@ GLogWriterOutput wp_log_writer_default (GLogLevelFlags log_level,
|
|||||||
const GLogField *fields, gsize n_fields, gpointer user_data);
|
const GLogField *fields, gsize n_fields, gpointer user_data);
|
||||||
|
|
||||||
WP_API
|
WP_API
|
||||||
void wp_log_structured_standard (const gchar *log_domain,
|
void wp_log_checked (const gchar *log_topic, GLogLevelFlags log_level,
|
||||||
GLogLevelFlags log_level, const gchar *file, const gchar *line,
|
const gchar *file, const gchar *line, const gchar *func,
|
||||||
const gchar *func, GType object_type, gconstpointer object,
|
GType object_type, gconstpointer object,
|
||||||
const gchar *message_format, ...) G_GNUC_PRINTF (8, 9);
|
const gchar *message_format, ...) G_GNUC_PRINTF (8, 9);
|
||||||
|
|
||||||
#define wp_log(level, type, object, ...) \
|
#define wp_log(topic, level, type, object, ...) \
|
||||||
({ \
|
({ \
|
||||||
if (G_UNLIKELY (wp_log_level_is_enabled (level))) \
|
if (G_UNLIKELY (wp_log_topic_is_enabled (topic, level))) \
|
||||||
wp_log_structured_standard (G_LOG_DOMAIN, level, __FILE__, \
|
wp_log_checked (topic->topic_name, level, __FILE__, G_STRINGIFY (__LINE__), \
|
||||||
G_STRINGIFY (__LINE__), G_STRFUNC, type, object, __VA_ARGS__); \
|
G_STRFUNC, type, object, __VA_ARGS__); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define wp_critical(...) \
|
#define wp_critical(...) \
|
||||||
wp_log (G_LOG_LEVEL_CRITICAL, 0, NULL, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_CRITICAL, 0, NULL, __VA_ARGS__)
|
||||||
#define wp_warning(...) \
|
#define wp_warning(...) \
|
||||||
wp_log (G_LOG_LEVEL_WARNING, 0, NULL, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_WARNING, 0, NULL, __VA_ARGS__)
|
||||||
#define wp_message(...) \
|
#define wp_message(...) \
|
||||||
wp_log (G_LOG_LEVEL_MESSAGE, 0, NULL, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_MESSAGE, 0, NULL, __VA_ARGS__)
|
||||||
#define wp_info(...) \
|
#define wp_info(...) \
|
||||||
wp_log (G_LOG_LEVEL_INFO, 0, NULL, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_INFO, 0, NULL, __VA_ARGS__)
|
||||||
#define wp_debug(...) \
|
#define wp_debug(...) \
|
||||||
wp_log (G_LOG_LEVEL_DEBUG, 0, NULL, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_DEBUG, 0, NULL, __VA_ARGS__)
|
||||||
#define wp_trace(...) \
|
#define wp_trace(...) \
|
||||||
wp_log (WP_LOG_LEVEL_TRACE, 0, NULL, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, WP_LOG_LEVEL_TRACE, 0, NULL, __VA_ARGS__)
|
||||||
|
|
||||||
#define wp_critical_object(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_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_CRITICAL, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)
|
||||||
#define wp_warning_object(object, ...) \
|
#define wp_warning_object(object, ...) \
|
||||||
wp_log (G_LOG_LEVEL_WARNING, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_WARNING, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)
|
||||||
#define wp_message_object(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_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_MESSAGE, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)
|
||||||
#define wp_info_object(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 (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_INFO, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)
|
||||||
#define wp_debug_object(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_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_DEBUG, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)
|
||||||
#define wp_trace_object(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_log (WP_LOCAL_LOG_TOPIC, WP_LOG_LEVEL_TRACE, (object) ? G_TYPE_FROM_INSTANCE (object) : G_TYPE_NONE, object, __VA_ARGS__)
|
||||||
|
|
||||||
#define wp_critical_boxed(type, object, ...) \
|
#define wp_critical_boxed(type, object, ...) \
|
||||||
wp_log (G_LOG_LEVEL_CRITICAL, type, object, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_CRITICAL, type, object, __VA_ARGS__)
|
||||||
#define wp_warning_boxed(type, object, ...) \
|
#define wp_warning_boxed(type, object, ...) \
|
||||||
wp_log (G_LOG_LEVEL_WARNING, type, object, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_WARNING, type, object, __VA_ARGS__)
|
||||||
#define wp_message_boxed(type, object, ...) \
|
#define wp_message_boxed(type, object, ...) \
|
||||||
wp_log (G_LOG_LEVEL_MESSAGE, type, object, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_MESSAGE, type, object, __VA_ARGS__)
|
||||||
#define wp_info_boxed(type, object, ...) \
|
#define wp_info_boxed(type, object, ...) \
|
||||||
wp_log (G_LOG_LEVEL_INFO, type, object, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_INFO, type, object, __VA_ARGS__)
|
||||||
#define wp_debug_boxed(type, object, ...) \
|
#define wp_debug_boxed(type, object, ...) \
|
||||||
wp_log (G_LOG_LEVEL_DEBUG, type, object, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, G_LOG_LEVEL_DEBUG, type, object, __VA_ARGS__)
|
||||||
#define wp_trace_boxed(type, object, ...) \
|
#define wp_trace_boxed(type, object, ...) \
|
||||||
wp_log (WP_LOG_LEVEL_TRACE, type, object, __VA_ARGS__)
|
wp_log (WP_LOCAL_LOG_TOPIC, WP_LOG_LEVEL_TRACE, type, object, __VA_ARGS__)
|
||||||
|
|
||||||
struct spa_log;
|
struct spa_log;
|
||||||
|
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-metadata"
|
|
||||||
|
|
||||||
#include "metadata.h"
|
#include "metadata.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -18,6 +16,8 @@
|
|||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/extensions/metadata.h>
|
#include <pipewire/extensions/metadata.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-metadata")
|
||||||
|
|
||||||
/*! \defgroup wpmetadata WpMetadata */
|
/*! \defgroup wpmetadata WpMetadata */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpMetadata
|
* \struct WpMetadata
|
||||||
|
@@ -6,11 +6,12 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-module"
|
#include "module.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include <pipewire/impl.h>
|
#include <pipewire/impl.h>
|
||||||
|
|
||||||
#include "module.h"
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-module")
|
||||||
|
|
||||||
/*! \defgroup wpimplmodule WpImplModule */
|
/*! \defgroup wpimplmodule WpImplModule */
|
||||||
/*!
|
/*!
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-node"
|
|
||||||
|
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "object-manager.h"
|
#include "object-manager.h"
|
||||||
@@ -17,6 +15,8 @@
|
|||||||
|
|
||||||
#include <pipewire/impl.h>
|
#include <pipewire/impl.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-node")
|
||||||
|
|
||||||
/*! \defgroup wpnode WpNode */
|
/*! \defgroup wpnode WpNode */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpNode
|
* \struct WpNode
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-object-interest"
|
|
||||||
|
|
||||||
#include "object-interest.h"
|
#include "object-interest.h"
|
||||||
#include "global-proxy.h"
|
#include "global-proxy.h"
|
||||||
#include "session-item.h"
|
#include "session-item.h"
|
||||||
@@ -18,6 +16,8 @@
|
|||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-object-interest")
|
||||||
|
|
||||||
/*! \defgroup wpobjectinterest WpObjectInterest */
|
/*! \defgroup wpobjectinterest WpObjectInterest */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpObjectInterest
|
* \struct WpObjectInterest
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-object-manager"
|
|
||||||
|
|
||||||
#include "object-manager.h"
|
#include "object-manager.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "proxy-interfaces.h"
|
#include "proxy-interfaces.h"
|
||||||
@@ -15,6 +13,8 @@
|
|||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-object-manager")
|
||||||
|
|
||||||
/*! \defgroup wpobjectmanager WpObjectManager */
|
/*! \defgroup wpobjectmanager WpObjectManager */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpObjectManager
|
* \struct WpObjectManager
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-object"
|
|
||||||
|
|
||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
|
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
@@ -15,6 +13,8 @@
|
|||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-object")
|
||||||
|
|
||||||
/*! \defgroup wpfeatureactivationtransition WpFeatureActivationTransition */
|
/*! \defgroup wpfeatureactivationtransition WpFeatureActivationTransition */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpFeatureActivationTransition
|
* \struct WpFeatureActivationTransition
|
||||||
|
@@ -6,12 +6,12 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-plugin"
|
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-plugin")
|
||||||
|
|
||||||
/*! \defgroup wpplugin WpPlugin */
|
/*! \defgroup wpplugin WpPlugin */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpPlugin
|
* \struct WpPlugin
|
||||||
|
@@ -6,11 +6,12 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-port"
|
|
||||||
|
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
|
#include "log.h"
|
||||||
#include "private/pipewire-object-mixin.h"
|
#include "private/pipewire-object-mixin.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-port")
|
||||||
|
|
||||||
/*! \defgroup wpport WpPort */
|
/*! \defgroup wpport WpPort */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpPort
|
* \struct WpPort
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-pw-obj-mixin"
|
|
||||||
|
|
||||||
#include "private/pipewire-object-mixin.h"
|
#include "private/pipewire-object-mixin.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "spa-type.h"
|
#include "spa-type.h"
|
||||||
@@ -17,6 +15,8 @@
|
|||||||
|
|
||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-pw-obj-mixin")
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (WpPwObjectMixinPriv, wp_pw_object_mixin_priv, WP_TYPE_PROXY)
|
G_DEFINE_INTERFACE (WpPwObjectMixinPriv, wp_pw_object_mixin_priv, WP_TYPE_PROXY)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -191,7 +191,7 @@ wp_pw_object_mixin_enum_params_unchecked (gpointer obj,
|
|||||||
task = g_task_new (obj, cancellable, callback, user_data);
|
task = g_task_new (obj, cancellable, callback, user_data);
|
||||||
|
|
||||||
/* debug */
|
/* debug */
|
||||||
if (wp_log_level_is_enabled (G_LOG_LEVEL_DEBUG)) {
|
if (wp_local_log_topic_is_enabled (G_LOG_LEVEL_DEBUG)) {
|
||||||
const gchar *name = NULL;
|
const gchar *name = NULL;
|
||||||
name = wp_spa_id_value_short_name (
|
name = wp_spa_id_value_short_name (
|
||||||
wp_spa_id_value_from_number ("Spa:Enum:ParamId", id));
|
wp_spa_id_value_from_number ("Spa:Enum:ParamId", id));
|
||||||
|
@@ -6,13 +6,14 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-properties"
|
|
||||||
|
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-properties")
|
||||||
|
|
||||||
/*! \defgroup wpproperties WpProperties */
|
/*! \defgroup wpproperties WpProperties */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpProperties
|
* \struct WpProperties
|
||||||
|
@@ -6,10 +6,11 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-proxy-ifaces"
|
|
||||||
|
|
||||||
#include "proxy-interfaces.h"
|
#include "proxy-interfaces.h"
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-proxy-ifaces")
|
||||||
|
|
||||||
/*! \defgroup wppipewireobject WpPipewireObject */
|
/*! \defgroup wppipewireobject WpPipewireObject */
|
||||||
/*!
|
/*!
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-proxy"
|
|
||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
@@ -16,6 +14,8 @@
|
|||||||
#include <spa/utils/hook.h>
|
#include <spa/utils/hook.h>
|
||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-proxy")
|
||||||
|
|
||||||
/*! \defgroup wpproxy WpProxy */
|
/*! \defgroup wpproxy WpProxy */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpProxy
|
* \struct WpProxy
|
||||||
|
@@ -6,13 +6,13 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-si"
|
|
||||||
|
|
||||||
#include "session-item.h"
|
#include "session-item.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-si")
|
||||||
|
|
||||||
/*! \defgroup wpsessionitem WpSessionItem */
|
/*! \defgroup wpsessionitem WpSessionItem */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpSessionItem
|
* \struct WpSessionItem
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-settings"
|
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "metadata.h"
|
#include "metadata.h"
|
||||||
@@ -15,6 +13,8 @@
|
|||||||
#include "object-manager.h"
|
#include "object-manager.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-settings")
|
||||||
|
|
||||||
/*! \defgroup wpsettings WpSettings */
|
/*! \defgroup wpsettings WpSettings */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpSettings
|
* \struct WpSettings
|
||||||
|
@@ -6,10 +6,11 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-si-factory"
|
|
||||||
|
|
||||||
#include "si-factory.h"
|
#include "si-factory.h"
|
||||||
#include "private/registry.h"
|
#include "private/registry.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-si-factory")
|
||||||
|
|
||||||
/*! \defgroup wpsifactory WpSiFactory */
|
/*! \defgroup wpsifactory WpSiFactory */
|
||||||
/*!
|
/*!
|
||||||
|
@@ -6,10 +6,11 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-si-interfaces"
|
|
||||||
|
|
||||||
#include "si-interfaces.h"
|
#include "si-interfaces.h"
|
||||||
#include "wpenums.h"
|
#include "wpenums.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-si-interfaces")
|
||||||
|
|
||||||
/*! \defgroup wpsiinterfaces Session Item Interfaces */
|
/*! \defgroup wpsiinterfaces Session Item Interfaces */
|
||||||
|
|
||||||
|
@@ -6,12 +6,13 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-spa-json"
|
#include "spa-json.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
#include <spa/utils/json.h>
|
#include <spa/utils/json.h>
|
||||||
|
|
||||||
#include "spa-json.h"
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-spa-json")
|
||||||
|
|
||||||
#define WP_SPA_JSON_STRING_INIT_SIZE 64
|
#define WP_SPA_JSON_STRING_INIT_SIZE 64
|
||||||
#define WP_SPA_JSON_BUILDER_INIT_SIZE 64
|
#define WP_SPA_JSON_BUILDER_INIT_SIZE 64
|
||||||
|
@@ -6,16 +6,17 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-spa-pod"
|
|
||||||
|
|
||||||
#include "spa-pod.h"
|
#include "spa-pod.h"
|
||||||
#include "spa-type.h"
|
#include "spa-type.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include <spa/utils/type-info.h>
|
#include <spa/utils/type-info.h>
|
||||||
#include <spa/pod/builder.h>
|
#include <spa/pod/builder.h>
|
||||||
#include <spa/pod/parser.h>
|
#include <spa/pod/parser.h>
|
||||||
#include <spa/pod/filter.h>
|
#include <spa/pod/filter.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-spa-pod")
|
||||||
|
|
||||||
#define WP_SPA_POD_BUILDER_REALLOC_STEP_SIZE 64
|
#define WP_SPA_POD_BUILDER_REALLOC_STEP_SIZE 64
|
||||||
#define WP_SPA_POD_ID_PROPERTY_NAME_MAX 16
|
#define WP_SPA_POD_ID_PROPERTY_NAME_MAX 16
|
||||||
|
|
||||||
|
@@ -6,14 +6,15 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-spa-type"
|
|
||||||
|
|
||||||
#include "spa-type.h"
|
#include "spa-type.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#include <spa/utils/type-info.h>
|
#include <spa/utils/type-info.h>
|
||||||
#include <spa/debug/types.h>
|
#include <spa/debug/types.h>
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-spa-type")
|
||||||
|
|
||||||
/*! \defgroup wpspatype WpSpaType
|
/*! \defgroup wpspatype WpSpaType
|
||||||
*
|
*
|
||||||
* Spa has a type system that is represented by a set of arrays that contain
|
* Spa has a type system that is represented by a set of arrays that contain
|
||||||
|
@@ -6,8 +6,6 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-state"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@@ -15,6 +13,8 @@
|
|||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "wp.h"
|
#include "wp.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-state")
|
||||||
|
|
||||||
#define ESCAPED_CHARACTER '\\'
|
#define ESCAPED_CHARACTER '\\'
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@@ -6,12 +6,12 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp-transition"
|
|
||||||
|
|
||||||
#include "transition.h"
|
#include "transition.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp-transition")
|
||||||
|
|
||||||
/*! \defgroup wptransition Transitions */
|
/*! \defgroup wptransition Transitions */
|
||||||
/*!
|
/*!
|
||||||
* \struct WpTransition
|
* \struct WpTransition
|
||||||
|
@@ -6,12 +6,12 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define G_LOG_DOMAIN "wp"
|
|
||||||
|
|
||||||
#include "wp.h"
|
#include "wp.h"
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wp")
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \defgroup wp Library Initialization
|
* \defgroup wp Library Initialization
|
||||||
* \{
|
* \{
|
||||||
|
@@ -8,7 +8,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-settings.c',
|
'module-settings.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-settings"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
@@ -19,7 +19,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-default-nodes-api.c',
|
'module-default-nodes-api.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-default-nodes-api"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
@@ -35,7 +35,7 @@ shared_library(
|
|||||||
reserve_device_interface_src,
|
reserve_device_interface_src,
|
||||||
reserve_device_enums,
|
reserve_device_enums,
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-reserve-device"'],
|
c_args : [common_c_args],
|
||||||
include_directories: reserve_device_includes,
|
include_directories: reserve_device_includes,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
@@ -47,7 +47,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-portal-permissionstore.c',
|
'module-portal-permissionstore.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-portal-permissionstore"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, giounix_dep],
|
dependencies : [wp_dep, giounix_dep],
|
||||||
@@ -58,7 +58,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-si-audio-adapter.c',
|
'module-si-audio-adapter.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-si-audio-adapter"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
@@ -69,7 +69,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-si-audio-virtual.c',
|
'module-si-audio-virtual.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-si-audio-virtual"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
@@ -80,7 +80,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-si-node.c',
|
'module-si-node.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-si-node"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
@@ -91,7 +91,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-si-standard-link.c',
|
'module-si-standard-link.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-si-standard-link"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
@@ -108,7 +108,7 @@ shared_library(
|
|||||||
'module-lua-scripting/api/api.c',
|
'module-lua-scripting/api/api.c',
|
||||||
m_lua_scripting_resources,
|
m_lua_scripting_resources,
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-lua-scripting"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep, wplua_dep, libintl_dep],
|
dependencies : [wp_dep, pipewire_dep, wplua_dep, libintl_dep],
|
||||||
@@ -119,7 +119,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-mixer-api.c',
|
'module-mixer-api.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-mixer-api"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep, mathlib],
|
dependencies : [wp_dep, pipewire_dep, mathlib],
|
||||||
@@ -130,7 +130,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-file-monitor-api.c',
|
'module-file-monitor-api.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-file-monitor-api"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
@@ -142,7 +142,7 @@ if libsystemd_dep.found() or libelogind_dep.found()
|
|||||||
[
|
[
|
||||||
'module-logind.c',
|
'module-logind.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-logind"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep, libsystemd_dep, libelogind_dep],
|
dependencies : [wp_dep, pipewire_dep, libsystemd_dep, libelogind_dep],
|
||||||
@@ -154,7 +154,7 @@ shared_library(
|
|||||||
[
|
[
|
||||||
'module-standard-event-source.c',
|
'module-standard-event-source.c',
|
||||||
],
|
],
|
||||||
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-standard-event-source"'],
|
c_args : [common_c_args],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : wireplumber_module_dir,
|
install_dir : wireplumber_module_dir,
|
||||||
dependencies : [wp_dep, pipewire_dep],
|
dependencies : [wp_dep, pipewire_dep],
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
#include <pipewire/keys.h>
|
#include <pipewire/keys.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-default-nodes-api")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Module Provides the APIs to query the default device nodes. Module looks at
|
* Module Provides the APIs to query the default device nodes. Module looks at
|
||||||
* the default metadata to know the default devices.
|
* the default metadata to know the default devices.
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include <wp/wp.h>
|
#include <wp/wp.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-file-monitor-api")
|
||||||
|
|
||||||
struct _WpFileMonitorApi
|
struct _WpFileMonitorApi
|
||||||
{
|
{
|
||||||
WpPlugin parent;
|
WpPlugin parent;
|
||||||
|
@@ -14,6 +14,8 @@
|
|||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
#include <spa/utils/string.h>
|
#include <spa/utils/string.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-logind")
|
||||||
|
|
||||||
#define NAME "logind"
|
#define NAME "logind"
|
||||||
|
|
||||||
struct _WpLogind
|
struct _WpLogind
|
||||||
|
@@ -12,6 +12,9 @@
|
|||||||
#include <wplua/wplua.h>
|
#include <wplua/wplua.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_lua_scripting
|
||||||
|
WP_LOG_TOPIC_EXTERN (log_topic_lua_scripting)
|
||||||
|
|
||||||
#define URI_API "resource:///org/freedesktop/pipewire/wireplumber/m-lua-scripting/api.lua"
|
#define URI_API "resource:///org/freedesktop/pipewire/wireplumber/m-lua-scripting/api.lua"
|
||||||
|
|
||||||
void wp_lua_scripting_pod_init (lua_State *L);
|
void wp_lua_scripting_pod_init (lua_State *L);
|
||||||
@@ -284,14 +287,13 @@ static int
|
|||||||
log_log (lua_State *L, GLogLevelFlags lvl)
|
log_log (lua_State *L, GLogLevelFlags lvl)
|
||||||
{
|
{
|
||||||
lua_Debug ar = {0};
|
lua_Debug ar = {0};
|
||||||
const gchar *message, *tmp;
|
const gchar *message;
|
||||||
gchar domain[25];
|
|
||||||
gchar line_str[11];
|
gchar line_str[11];
|
||||||
gconstpointer instance = NULL;
|
gconstpointer instance = NULL;
|
||||||
GType type = G_TYPE_INVALID;
|
GType type = G_TYPE_INVALID;
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
|
||||||
if (!wp_log_level_is_enabled (lvl))
|
if (!wp_log_topic_is_enabled (log_topic_lua_scripting, lvl))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
g_warn_if_fail (lua_getstack (L, 1, &ar) == 1);
|
g_warn_if_fail (lua_getstack (L, 1, &ar) == 1);
|
||||||
@@ -309,14 +311,10 @@ log_log (lua_State *L, GLogLevelFlags lvl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
message = luaL_checkstring (L, index);
|
message = luaL_checkstring (L, index);
|
||||||
tmp = ar.source ? g_strrstr (ar.source, ".lua") : NULL;
|
|
||||||
snprintf (domain, 25, "script/%.*s",
|
|
||||||
tmp ? MIN((gint)(tmp - ar.source), 17) : 17,
|
|
||||||
ar.source);
|
|
||||||
snprintf (line_str, 11, "%d", ar.currentline);
|
snprintf (line_str, 11, "%d", ar.currentline);
|
||||||
ar.name = ar.name ? ar.name : "chunk";
|
ar.name = ar.name ? ar.name : "chunk";
|
||||||
|
|
||||||
wp_log_structured_standard (domain, lvl,
|
wp_log_checked (log_topic_lua_scripting->topic_name, lvl,
|
||||||
ar.source, line_str, ar.name, type, instance, "%s", message);
|
ar.source, line_str, ar.name, type, instance, "%s", message);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,9 @@
|
|||||||
#include <wp/wp.h>
|
#include <wp/wp.h>
|
||||||
#include <wplua/wplua.h>
|
#include <wplua/wplua.h>
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_lua_scripting
|
||||||
|
WP_LOG_TOPIC_EXTERN (log_topic_lua_scripting)
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
#include <spa/utils/type.h>
|
#include <spa/utils/type.h>
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_lua_scripting
|
||||||
|
WP_LOG_TOPIC_EXTERN (log_topic_lua_scripting)
|
||||||
|
|
||||||
#define MAX_LUA_TYPES 9
|
#define MAX_LUA_TYPES 9
|
||||||
|
|
||||||
/* Builder */
|
/* Builder */
|
||||||
|
@@ -9,6 +9,9 @@
|
|||||||
#include <wp/wp.h>
|
#include <wp/wp.h>
|
||||||
#include <wplua/wplua.h>
|
#include <wplua/wplua.h>
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_lua_scripting
|
||||||
|
WP_LOG_TOPIC_EXTERN (log_topic_lua_scripting)
|
||||||
|
|
||||||
struct _WpRequireApiTransition
|
struct _WpRequireApiTransition
|
||||||
{
|
{
|
||||||
WpTransition parent;
|
WpTransition parent;
|
||||||
|
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
#include "script.h"
|
#include "script.h"
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_lua_scripting
|
||||||
|
WP_LOG_TOPIC (log_topic_lua_scripting, "m-lua-scripting")
|
||||||
|
|
||||||
void wp_lua_scripting_api_init (lua_State *L);
|
void wp_lua_scripting_api_init (lua_State *L);
|
||||||
|
|
||||||
struct _WpLuaScriptingPlugin
|
struct _WpLuaScriptingPlugin
|
||||||
|
@@ -9,6 +9,9 @@
|
|||||||
#include "script.h"
|
#include "script.h"
|
||||||
#include <pipewire/keys.h>
|
#include <pipewire/keys.h>
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_lua_scripting
|
||||||
|
WP_LOG_TOPIC_EXTERN (log_topic_lua_scripting)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a WpPlugin subclass that wraps a single lua script and acts like
|
* This is a WpPlugin subclass that wraps a single lua script and acts like
|
||||||
* a handle for that script. When enabled, through the WpObject activation
|
* a handle for that script. When enabled, through the WpObject activation
|
||||||
|
@@ -19,7 +19,6 @@ wplua_lib = static_library('wplua-' + wireplumber_api_version,
|
|||||||
c_args : [
|
c_args : [
|
||||||
'-D_GNU_SOURCE',
|
'-D_GNU_SOURCE',
|
||||||
'-DG_LOG_USE_STRUCTURED',
|
'-DG_LOG_USE_STRUCTURED',
|
||||||
'-DG_LOG_DOMAIN="wplua"',
|
|
||||||
],
|
],
|
||||||
install: false,
|
install: false,
|
||||||
include_directories: wplua_include_dir,
|
include_directories: wplua_include_dir,
|
||||||
|
@@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_wplua
|
||||||
|
WP_LOG_TOPIC_EXTERN (log_topic_wplua)
|
||||||
|
|
||||||
/* boxed.c */
|
/* boxed.c */
|
||||||
void _wplua_init_gboxed (lua_State *L);
|
void _wplua_init_gboxed (lua_State *L);
|
||||||
|
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include <wp/wp.h>
|
#include <wp/wp.h>
|
||||||
|
|
||||||
|
WP_LOG_TOPIC (log_topic_wplua, "wplua")
|
||||||
|
|
||||||
#define URI_SANDBOX "resource:///org/freedesktop/pipewire/wireplumber/wplua/sandbox.lua"
|
#define URI_SANDBOX "resource:///org/freedesktop/pipewire/wireplumber/wplua/sandbox.lua"
|
||||||
|
|
||||||
extern void _wplua_register_resource (void);
|
extern void _wplua_register_resource (void);
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
#include <spa/pod/iter.h>
|
#include <spa/pod/iter.h>
|
||||||
#include <spa/param/audio/raw.h>
|
#include <spa/param/audio/raw.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-mixer-api")
|
||||||
|
|
||||||
struct volume {
|
struct volume {
|
||||||
uint8_t channels;
|
uint8_t channels;
|
||||||
float values[SPA_AUDIO_MAX_CHANNELS];
|
float values[SPA_AUDIO_MAX_CHANNELS];
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include <wp/wp.h>
|
#include <wp/wp.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-portal-permissionstore")
|
||||||
|
|
||||||
#define DBUS_INTERFACE_NAME "org.freedesktop.impl.portal.PermissionStore"
|
#define DBUS_INTERFACE_NAME "org.freedesktop.impl.portal.PermissionStore"
|
||||||
#define DBUS_OBJECT_PATH "/org/freedesktop/impl/portal/PermissionStore"
|
#define DBUS_OBJECT_PATH "/org/freedesktop/impl/portal/PermissionStore"
|
||||||
|
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
#include "reserve-device.h"
|
#include "reserve-device.h"
|
||||||
#include "reserve-device-enums.h"
|
#include "reserve-device-enums.h"
|
||||||
|
|
||||||
|
WP_LOG_TOPIC (log_topic_rd, "m-reserve-device")
|
||||||
|
|
||||||
G_DEFINE_TYPE (WpReserveDevicePlugin, wp_reserve_device_plugin, WP_TYPE_PLUGIN)
|
G_DEFINE_TYPE (WpReserveDevicePlugin, wp_reserve_device_plugin, WP_TYPE_PLUGIN)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define WP_LOCAL_LOG_TOPIC log_topic_rd
|
||||||
|
WP_LOG_TOPIC_EXTERN (log_topic_rd)
|
||||||
|
|
||||||
#define FDO_RESERVE_DEVICE1_SERVICE "org.freedesktop.ReserveDevice1"
|
#define FDO_RESERVE_DEVICE1_SERVICE "org.freedesktop.ReserveDevice1"
|
||||||
#define FDO_RESERVE_DEVICE1_PATH "/org/freedesktop/ReserveDevice1"
|
#define FDO_RESERVE_DEVICE1_PATH "/org/freedesktop/ReserveDevice1"
|
||||||
|
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
#include <spa/utils/json.h>
|
#include <spa/utils/json.h>
|
||||||
#include <spa/utils/defs.h>
|
#include <spa/utils/defs.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-settings")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This module parses the "wireplumber.settings" section from the .conf file.
|
* This module parses the "wireplumber.settings" section from the .conf file.
|
||||||
*
|
*
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
#include <spa/param/param.h>
|
#include <spa/param/param.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-si-audio-adapter")
|
||||||
|
|
||||||
#define SI_FACTORY_NAME "si-audio-adapter"
|
#define SI_FACTORY_NAME "si-audio-adapter"
|
||||||
|
|
||||||
struct _WpSiAudioAdapter
|
struct _WpSiAudioAdapter
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
#include <spa/param/audio/raw.h>
|
#include <spa/param/audio/raw.h>
|
||||||
#include <spa/param/param.h>
|
#include <spa/param/param.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-si-audio-virtual")
|
||||||
|
|
||||||
#define SI_FACTORY_NAME "si-audio-virtual"
|
#define SI_FACTORY_NAME "si-audio-virtual"
|
||||||
|
|
||||||
struct _WpSiAudioVirtual
|
struct _WpSiAudioVirtual
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
#include <pipewire/properties.h>
|
#include <pipewire/properties.h>
|
||||||
#include <pipewire/extensions/session-manager/keys.h>
|
#include <pipewire/extensions/session-manager/keys.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-si-node")
|
||||||
|
|
||||||
#define SI_FACTORY_NAME "si-node"
|
#define SI_FACTORY_NAME "si-node"
|
||||||
|
|
||||||
struct _WpSiNode
|
struct _WpSiNode
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
#include <spa/debug/types.h>
|
#include <spa/debug/types.h>
|
||||||
#include <spa/param/audio/type-info.h>
|
#include <spa/param/audio/type-info.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-si-standard-link")
|
||||||
|
|
||||||
#define SI_FACTORY_NAME "si-standard-link"
|
#define SI_FACTORY_NAME "si-standard-link"
|
||||||
|
|
||||||
struct _WpSiStandardLink
|
struct _WpSiStandardLink
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include <wp/wp.h>
|
#include <wp/wp.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("m-standard-event-source")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Module subscribes for certain object manager events to and pushes them as
|
* Module subscribes for certain object manager events to and pushes them as
|
||||||
* events on to the Event Stack.
|
* events on to the Event Stack.
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wireplumber")
|
||||||
|
|
||||||
#define WP_DOMAIN_DAEMON (wp_domain_daemon_quark ())
|
#define WP_DOMAIN_DAEMON (wp_domain_daemon_quark ())
|
||||||
static G_DEFINE_QUARK (wireplumber-daemon, wp_domain_daemon);
|
static G_DEFINE_QUARK (wireplumber-daemon, wp_domain_daemon);
|
||||||
|
|
||||||
|
@@ -23,7 +23,6 @@ if build_daemon
|
|||||||
c_args : [
|
c_args : [
|
||||||
'-D_GNU_SOURCE',
|
'-D_GNU_SOURCE',
|
||||||
'-DG_LOG_USE_STRUCTURED',
|
'-DG_LOG_USE_STRUCTURED',
|
||||||
'-DG_LOG_DOMAIN="wireplumber"',
|
|
||||||
],
|
],
|
||||||
install: true,
|
install: true,
|
||||||
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
|
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
|
||||||
|
@@ -3,7 +3,6 @@ executable('wpctl',
|
|||||||
c_args : [
|
c_args : [
|
||||||
'-D_GNU_SOURCE',
|
'-D_GNU_SOURCE',
|
||||||
'-DG_LOG_USE_STRUCTURED',
|
'-DG_LOG_USE_STRUCTURED',
|
||||||
'-DG_LOG_DOMAIN="wpctl"',
|
|
||||||
],
|
],
|
||||||
install: true,
|
install: true,
|
||||||
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
|
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
|
||||||
@@ -14,7 +13,6 @@ executable('wpexec',
|
|||||||
c_args : [
|
c_args : [
|
||||||
'-D_GNU_SOURCE',
|
'-D_GNU_SOURCE',
|
||||||
'-DG_LOG_USE_STRUCTURED',
|
'-DG_LOG_USE_STRUCTURED',
|
||||||
'-DG_LOG_DOMAIN="wpexec"',
|
|
||||||
],
|
],
|
||||||
install: true,
|
install: true,
|
||||||
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
|
dependencies : [gobject_dep, gio_dep, wp_dep, pipewire_dep],
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
#include <pipewire/keys.h>
|
#include <pipewire/keys.h>
|
||||||
#include <pipewire/extensions/session-manager/keys.h>
|
#include <pipewire/extensions/session-manager/keys.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wpctl")
|
||||||
|
|
||||||
static const gchar *DEFAULT_NODE_MEDIA_CLASSES[] = {
|
static const gchar *DEFAULT_NODE_MEDIA_CLASSES[] = {
|
||||||
"Audio/Sink",
|
"Audio/Sink",
|
||||||
"Audio/Source",
|
"Audio/Source",
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("wpexec")
|
||||||
|
|
||||||
#define WP_DOMAIN_DAEMON (wp_domain_daemon_quark ())
|
#define WP_DOMAIN_DAEMON (wp_domain_daemon_quark ())
|
||||||
static G_DEFINE_QUARK (wireplumber-daemon, wp_domain_daemon);
|
static G_DEFINE_QUARK (wireplumber-daemon, wp_domain_daemon);
|
||||||
|
|
||||||
@@ -238,12 +240,6 @@ main (gint argc, gchar **argv)
|
|||||||
g_signal_connect_swapped (d.core, "disconnected",
|
g_signal_connect_swapped (d.core, "disconnected",
|
||||||
G_CALLBACK (g_main_loop_quit), d.loop);
|
G_CALLBACK (g_main_loop_quit), d.loop);
|
||||||
|
|
||||||
/* at the very least, enable warnings...
|
|
||||||
this is required to spot lua runtime errors, otherwise
|
|
||||||
there is silence and nothing is happening */
|
|
||||||
if (!wp_log_level_is_enabled (G_LOG_LEVEL_WARNING))
|
|
||||||
wp_log_set_level ("1");
|
|
||||||
|
|
||||||
/* watch for exit signals */
|
/* watch for exit signals */
|
||||||
g_unix_signal_add (SIGINT, signal_handler, &d);
|
g_unix_signal_add (SIGINT, signal_handler, &d);
|
||||||
g_unix_signal_add (SIGTERM, signal_handler, &d);
|
g_unix_signal_add (SIGTERM, signal_handler, &d);
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "test-server.h"
|
#include "test-server.h"
|
||||||
|
#include "test-log.h"
|
||||||
#include <wp/wp.h>
|
#include <wp/wp.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
11
tests/common/test-log.h
Normal file
11
tests/common/test-log.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/* WirePlumber
|
||||||
|
*
|
||||||
|
* Copyright © 2023 Collabora Ltd.
|
||||||
|
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <wp/wp.h>
|
||||||
|
|
||||||
|
WP_DEFINE_LOCAL_LOG_TOPIC ("tests")
|
@@ -6,7 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wp/wp.h>
|
#include "../common/test-log.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wp/wp.h>
|
#include "../common/test-log.h"
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wp/wp.h>
|
#include "../common/test-log.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_spa_json_basic (void)
|
test_spa_json_basic (void)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wp/wp.h>
|
#include "../common/test-log.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_spa_pod_basic (void)
|
test_spa_pod_basic (void)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wp/wp.h>
|
#include "../common/test-log.h"
|
||||||
#include <spa/utils/type-info.h>
|
#include <spa/utils/type-info.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wp/wp.h>
|
#include "../common/test-log.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_state_basic (void)
|
test_state_basic (void)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wp/wp.h>
|
#include "../common/test-log.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STEP_FIRST = WP_TRANSITION_STEP_CUSTOM_START,
|
STEP_FIRST = WP_TRANSITION_STEP_CUSTOM_START,
|
||||||
|
@@ -6,9 +6,8 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lua.h"
|
#include "../common/test-log.h"
|
||||||
#include <wplua/wplua.h>
|
#include <wplua/wplua.h>
|
||||||
#include <wp/wp.h>
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
Reference in New Issue
Block a user