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

@ -46,6 +46,8 @@
#define LISTEN_BACKLOG 32
#define MAX_CLIENTS 64
PW_LOG_TOPIC_EXTERN(pulse_conn);
static int handle_packet(struct client *client, struct message *msg)
{
uint32_t command, tag;
@ -67,7 +69,7 @@ static int handle_packet(struct client *client, struct message *msg)
goto finish;
}
if (debug_messages) {
if (pw_log_topic_custom_enabled(SPA_LOG_LEVEL_INFO, pulse_conn)) {
pw_log_debug("client %p: command:%s", client, commands[command].name);
message_dump(SPA_LOG_LEVEL_INFO, msg);
}