[PATCH] log: allow log register API to update log level

Bharath Paulraj bharathpaul at gmail.com
Fri Aug 9 15:01:49 CEST 2024


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

Signed-off-by: Bharath Paulraj <bharathpaul at gmail.com>
---
 .mailmap      | 1 +
 lib/log/log.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index 4a508bafad..05eca16a96 100644
--- a/.mailmap
+++ b/.mailmap
@@ -181,6 +181,7 @@ Bernard Iremonger <bernard.iremonger at intel.com>
 Bert van Leeuwen <bert.vanleeuwen at netronome.com>
 Bhagyada Modali <bhagyada.modali at amd.com>
 Bharat Mota <bharat.mota at broadcom.com> <bmota at vmware.com>
+Bharath Paulraj <bharathpaul at gmail.com>
 Bhuvan Mital <bhuvan.mital at amd.com>
 Bill Hong <bhong at brocade.com>
 Billy McFall <bmcfall at redhat.com>
diff --git a/lib/log/log.c b/lib/log/log.c
index 255f757d94..4338795b16 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -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) *
-- 
2.34.1



More information about the dev mailing list