Skip to contentSkip to conversation

log: allow log register API to update log level

PATCH In review Bharath Paulraj 2 participants 2 messages Aug 9, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 log: allow log register API to update log level

This commit fixes the bug in the registration API where it fails to set the log level if 'id' already exists.

---
 .mailmap      | 1 +
 lib/log/log.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
.mailmap +1 -0
index 4a508bafad..05eca16a96 100644
@@ -181,6 +181,7 @@ Bernard Iremonger <[email protected]>
 Bert van Leeuwen <[email protected]>
 Bhagyada Modali <[email protected]>
 Bharat Mota <[email protected]> <[email protected]>
+Bharath Paulraj <[email protected]>
 Bhuvan Mital <[email protected]>
 Bill Hong <[email protected]>
 Billy McFall <[email protected]>
lib/log/log.c +3 -1
index 255f757d94..4338795b16 100644
@@ -292,8 +292,10 @@ log_register(const char *name, uint32_t level)
 	int id;
 
 	id = log_lookup(name);
-	if (id >= 0)
+	if (id >= 0) {
+		logtype_set_level(id, level);
 		return id;
+	}
 
 	new_dynamic_types = realloc(rte_logs.dynamic_types,
 		sizeof(struct rte_log_dynamic_type) *
Signature · 1 line
2.34.1
#1 lore raw

09/08/2024 15:01, Bharath Paulraj:

Quoted 2 lines

This commit fixes the bug in the registration API where it fails to set the log level if 'id' already exists.

Why registering twice?