From 905106863001f2f4cd202279cc0a8a11022ef14b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 22 Oct 2018 16:48:52 +0300 Subject: [PATCH] net: buf: Fix debug level setting Some of the net_buf related tests failed if they enabled CONFIG_NET_BUF_LOG setting. Signed-off-by: Jukka Rissanen --- subsys/net/Kconfig | 3 ++- subsys/net/buf.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/subsys/net/Kconfig b/subsys/net/Kconfig index 377e96badb..6a64f745f8 100644 --- a/subsys/net/Kconfig +++ b/subsys/net/Kconfig @@ -33,9 +33,10 @@ config NET_BUF_LOG module = NET_BUF module-dep = LOG +module-def = LOG_LEVEL_WRN module-str = Log level for network buffer handling module-help = Sets log level for network buffers. -source "subsys/net/Kconfig.template.log_config.net" +source "subsys/net/Kconfig.template.log_config.default.net" if NET_BUF_LOG diff --git a/subsys/net/buf.c b/subsys/net/buf.c index ee80f3acbc..280d1a652f 100644 --- a/subsys/net/buf.c +++ b/subsys/net/buf.c @@ -6,6 +6,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_buf +#define LOG_LEVEL CONFIG_NET_BUF_LOG_LEVEL + +#include +LOG_MODULE_REGISTER(LOG_MODULE_NAME); + #include #include #include @@ -15,12 +21,6 @@ #include #if defined(CONFIG_NET_BUF_LOG) -#define LOG_MODULE_NAME net_buf -#define NET_LOG_LEVEL CONFIG_NET_BUF_LOG_LEVEL - -#include -LOG_MODULE_REGISTER(); - #define NET_BUF_DBG(fmt, ...) LOG_DBG("(%p) " fmt, k_current_get(), \ ##__VA_ARGS__) #define NET_BUF_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)