diff mbox series

[BlueZ,v2,4/9] adapter: Don't use DBG in mgmt_debug

Message ID 20220323000654.3157833-4-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v2,1/9] log: Introduce DBG_IS_ENABLED | expand

Commit Message

Luiz Augusto von Dentz March 23, 2022, 12:06 a.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

mgmt_debug callback is used to print debug strings from mgmt instances
which includes the file and function names so using DBG would add yet
another set of file and function prefixes which makes the logs
confusing.
---
 src/adapter.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 97ce26f8e..6680c5410 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -10327,9 +10327,8 @@  static void read_version_complete(uint8_t status, uint16_t length,
 
 static void mgmt_debug(const char *str, void *user_data)
 {
-	const char *prefix = user_data;
-
-	info("%s%s", prefix, str);
+	if (DBG_IS_ENABLED())
+		btd_debug(0xffff, "%s", str);
 }
 
 int adapter_init(void)
@@ -10342,8 +10341,7 @@  int adapter_init(void)
 		return -EIO;
 	}
 
-	if (getenv("MGMT_DEBUG"))
-		mgmt_set_debug(mgmt_primary, mgmt_debug, "mgmt: ", NULL);
+	mgmt_set_debug(mgmt_primary, mgmt_debug, NULL, NULL);
 
 	DBG("sending read version command");