modules: switch protocol-native to the new logging system

This is more complicated than a normal module because we have two
logging topics: mod.protocol-native and conn.protocol-native for wire
messages. Because the latter use spa_debug (through spa_debug_pod) we
need to #define our way around so those too use the right topics.

Note that this removes the previous "connection" category, it is now
"conn.protocol-native" instead.
This commit is contained in:
Peter Hutterer 2021-09-17 10:12:28 +10:00 committed by Wim Taymans
parent 14112fd168
commit 96f8a7597e
6 changed files with 58 additions and 32 deletions

View file

@ -36,7 +36,12 @@
#include <pipewire/pipewire.h>
#define spa_debug pw_log_debug
PW_LOG_TOPIC_EXTERN(mod_topic);
#define PW_LOG_TOPIC_DEFAULT mod_topic
PW_LOG_TOPIC_EXTERN(mod_topic_connection);
#undef spa_debug
#define spa_debug(...) pw_logt_debug(mod_topic_connection, __VA_ARGS__)
#include <spa/debug/pod.h>
#include "connection.h"
@ -48,8 +53,6 @@
#define HDR_SIZE_V0 8
#define HDR_SIZE 16
static bool debug_messages = 0;
struct buffer {
uint8_t *buffer_data;
size_t buffer_size;
@ -367,7 +370,6 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct p
if (impl == NULL)
return NULL;
debug_messages = pw_debug_is_category_enabled("connection");
impl->context = context;
this = &impl->this;
@ -633,7 +635,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
else
buf->n_fds = buf->msg.n_fds;
if (debug_messages) {
if (mod_topic_connection->level >= SPA_LOG_LEVEL_DEBUG) {
pw_log_debug(">>>>>>>>> out: id:%d op:%d size:%d seq:%d",
buf->msg.id, buf->msg.opcode, size, buf->msg.seq);
spa_debug_pod(0, NULL, SPA_PTROFF(p, impl->hdr_size, struct spa_pod));