log: allow log register API to update log level

Message ID 20240809130149.363053-1-bharathpaul@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Thomas Monjalon
Headers
Series log: allow log register API to update log level |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-broadcom-Performance pending Performance Testing pending
ci/iol-abi-testing warning Testing issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing pending Testing pending
ci/iol-compile-amd64-testing pending Testing pending
ci/iol-compile-arm64-testing pending Testing pending
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-amd64-testing pending Testing pending

Commit Message

Bharath Paulraj Aug. 9, 2024, 1:01 p.m. UTC
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@gmail.com>
---
 .mailmap      | 1 +
 lib/log/log.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon Aug. 9, 2024, 2:06 p.m. UTC | #1
09/08/2024 15:01, Bharath Paulraj:
> This commit fixes the bug in the registration API where it fails to
> set the log level if 'id' already exists.

Why registering twice?
  

Patch

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