From 5152c987895634501314d05fbc90a7ecadf35b29 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 4 Jan 2024 17:30:21 +0100 Subject: [PATCH] log: store log level in topics When there is no specific level for a topic we store the global log level in the topic level. Make sure this invariant is preserved when the the global log level is updated. We can then simply update the log level after we processed the log level string to update all topics. This should also make it possible to just use the level from the topic in all cases and remove a check. --- src/pipewire/log.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pipewire/log.c b/src/pipewire/log.c index a2ce73f9f..8f29ddac1 100644 --- a/src/pipewire/log.c +++ b/src/pipewire/log.c @@ -226,6 +226,8 @@ void pw_log_set_level(enum spa_log_level level) { pw_log_level = level; global_log->level = level; + + update_all_topic_levels(); } static int add_pattern(struct spa_list *list, const char *str, enum spa_log_level level) @@ -327,9 +329,6 @@ int pw_log_set_level_string(const char *str) if ((res = parse_log_string(str, &new_patterns, &level)) < 0) return res; - pw_log_level = level; - global_log->level = level; - pthread_mutex_lock(&topics_lock); spa_list_consume(pattern, &patterns, link) { @@ -341,7 +340,7 @@ int pw_log_set_level_string(const char *str) pthread_mutex_unlock(&topics_lock); - update_all_topic_levels(); + pw_log_set_level(level); return 0; }