log: add pw_log_topic_custom_enabled()

Add a function to check if a specfic custom log level has been defined
for a topic.

We can use this to dynamically check if we need to do the connection debug
messages.

We can also get rid of the conn.* pattern hack to disable connection
messages by default.
This commit is contained in:
Wim Taymans 2024-01-04 17:40:57 +01:00
parent 5152c98789
commit a3c6b3acae
8 changed files with 14 additions and 22 deletions

View file

@ -29,6 +29,8 @@
#include "server.h"
#include "stream.h"
PW_LOG_TOPIC_EXTERN(pulse_conn);
#define client_emit_disconnect(c) spa_hook_list_call(&(c)->listener_list, struct client_events, disconnect, 0)
struct client *client_new(struct server *server)
@ -232,7 +234,8 @@ static int client_try_flush_messages(struct client *client)
data = m->data + idx;
size = m->length - idx;
} else {
if (debug_messages && m->channel == SPA_ID_INVALID)
if (m->channel == SPA_ID_INVALID &&
pw_log_topic_custom_enabled(SPA_LOG_LEVEL_INFO, pulse_conn))
message_dump(SPA_LOG_LEVEL_INFO, m);
message_free(m, true, false);
client->out_index = 0;