From 31d8d5d28eff2153a1425f3a8e51e7b45e3e2441 Mon Sep 17 00:00:00 2001
From: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
Date: Fri, 31 Jan 2025 14:51:25 +0100
Subject: [PATCH] Include method name in the error log to improve debugging of
 UBUS object lookups

---
 libbbfdm-api/legacy/dmbbf.c         | 2 +-
 libbbfdm-api/legacy/dmubus.c        | 6 +++---
 libbbfdm-api/version-2/bbfdm_ubus.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libbbfdm-api/legacy/dmbbf.c b/libbbfdm-api/legacy/dmbbf.c
index 5740096ce..15f1b7367 100644
--- a/libbbfdm-api/legacy/dmbbf.c
+++ b/libbbfdm-api/legacy/dmbbf.c
@@ -1055,7 +1055,7 @@ static int ubus_call_blob_msg(const char *obj, const char *method, struct blob_b
 	}
 
 	if (ubus_lookup_id(ubus_ctx, obj, &id)) {
-		BBF_ERR("Failed to lookup UBUS object ID for '%s'", obj);
+		BBF_ERR("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method);
 		ubus_free(ubus_ctx);
 		return -1;
 	}
diff --git a/libbbfdm-api/legacy/dmubus.c b/libbbfdm-api/legacy/dmubus.c
index 1dda190fb..746b2f294 100644
--- a/libbbfdm-api/legacy/dmubus.c
+++ b/libbbfdm-api/legacy/dmubus.c
@@ -111,7 +111,7 @@ static int __dm_ubus_call_internal(const char *obj, const char *method, int time
 	}
 
 	if (ubus_lookup_id(ubus_ctx, obj, &id)) {
-		BBF_ERR("Failed to lookup UBUS object ID for '%s'", obj);
+		BBF_ERR("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method);
 		return -1;
 	}
 
@@ -350,7 +350,7 @@ static int dmubus_call_blob_internal(const char *obj, const char *method, json_o
 	}
 
 	if (ubus_lookup_id(ubus_ctx, obj, &id)) {
-		BBF_ERR("Failed to lookup UBUS object ID for '%s'", obj);
+		BBF_ERR("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method);
 		blob_buf_free(&blob);
 		return rc;
 	}
@@ -403,7 +403,7 @@ static int dmubus_call_blob_msg_internal(const char *obj, const char *method, st
 	}
 
 	if (ubus_lookup_id(ubus_ctx, obj, &id)) {
-		BBF_ERR("Failed to lookup UBUS object ID for '%s'", obj);
+		BBF_ERR("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method);
 		return -1;
 	}
 
diff --git a/libbbfdm-api/version-2/bbfdm_ubus.c b/libbbfdm-api/version-2/bbfdm_ubus.c
index b0ab14b20..aaf274c77 100644
--- a/libbbfdm-api/version-2/bbfdm_ubus.c
+++ b/libbbfdm-api/version-2/bbfdm_ubus.c
@@ -42,7 +42,7 @@ int bbfdm_ubus_invoke_sync(struct bbfdm_ctx *bbfdm_ctx, const char *obj, const c
 	}
 
 	if (ubus_lookup_id(bbfdm_ctx->ubus_ctx, obj, &id)) {
-		BBFDM_ERR("Failed to lookup UBUS object ID for '%s'", obj);
+		BBFDM_ERR("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method);
 		return -1;
 	}
 
@@ -67,7 +67,7 @@ int bbfdm_ubus_invoke_async(struct ubus_context *ubus_ctx, const char *obj, cons
 	}
 
 	if (ubus_lookup_id(ubus_ctx, obj, &id)) {
-		BBFDM_ERR("Failed to lookup UBUS object ID for '%s'", obj);
+		BBFDM_ERR("Failed to lookup UBUS object ID for '%s' using method '%s'", obj, method);
 		return -1;
 	}
 
-- 
GitLab