Skip to content

Commit 6973c6a

Browse files
committed
net: logging: Remove function name from NET_DBG if needed
The logger will add the function name automatically if CONFIG_LOG_FUNCTION_NAME is set, so no need to do it here in that case. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent a794e39 commit 6973c6a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

include/net/net_core.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ extern "C" {
5454
LOG_MODULE_REGISTER(LOG_MODULE_NAME);
5555
#endif /* NET_LOG_LEVEL */
5656

57-
#define NET_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \
58-
__func__, ##__VA_ARGS__)
57+
#if defined(CONFIG_LOG_FUNCTION_NAME)
58+
#define NET_DBG(fmt, ...) LOG_DBG("(%p): " fmt, k_current_get(), \
59+
##__VA_ARGS__)
60+
#else
61+
#define NET_DBG(fmt, ...) LOG_DBG("%s(): (%p): " fmt, __func__, \
62+
k_current_get(), ##__VA_ARGS__)
63+
#endif /* CONFIG_LOG_FUNCTION_NAME */
5964
#define NET_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
6065
#define NET_WARN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
6166
#define NET_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)

0 commit comments

Comments
 (0)