From f3f04bf9eb9b7737f5b8a10fd25eca6df5051c77 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 3 Sep 2018 17:49:13 +0300 Subject: [PATCH] tests: net: Convert to new logging system Use new logging system with support for network log level. Signed-off-by: Jukka Rissanen --- tests/net/6lo/prj.conf | 7 +- tests/net/6lo/src/main.c | 3 + tests/net/all/prj.conf | 66 ++++++++++--------- tests/net/all/src/main.c | 3 + tests/net/app/prj.conf | 4 -- tests/net/app/src/main.c | 5 +- tests/net/arp/prj.conf | 6 -- tests/net/arp/src/main.c | 3 + tests/net/buf/prj.conf | 2 +- tests/net/checksum_offload/prj.conf | 9 --- tests/net/checksum_offload/src/main.c | 7 +- tests/net/context/prj.conf | 9 --- tests/net/context/src/main.c | 5 +- tests/net/dhcpv4/prj.conf | 10 --- tests/net/dhcpv4/src/main.c | 3 + tests/net/ethernet_mgmt/prj.conf | 1 - tests/net/ethernet_mgmt/src/main.c | 3 + tests/net/icmpv6/prj.conf | 1 - tests/net/icmpv6/src/main.c | 3 + tests/net/ieee802154/crypto/prj.conf | 14 ---- .../crypto/src/ieee802154_crypto_test.c | 7 +- tests/net/ieee802154/fragment/prj.conf | 6 -- tests/net/ieee802154/fragment/src/main.c | 3 + tests/net/ieee802154/l2/prj.conf | 5 +- tests/net/iface/prj.conf | 3 - tests/net/iface/src/main.c | 7 +- tests/net/ip-addr/prj.conf | 1 - tests/net/ip-addr/src/main.c | 5 +- tests/net/ipv6/prj.conf | 11 +--- tests/net/ipv6/src/main.c | 5 +- tests/net/ipv6_fragment/prj.conf | 9 --- tests/net/ipv6_fragment/src/main.c | 5 +- tests/net/lib/coap/prj.conf | 1 - tests/net/lib/coap/src/main.c | 3 + tests/net/lib/dns_resolve/prj-no-ipv6.conf | 3 - tests/net/lib/dns_resolve/prj.conf | 3 - tests/net/lib/dns_resolve/src/main.c | 5 +- .../mqtt_publisher/src/test_mqtt_publish.c | 3 + .../mqtt_subscriber/src/test_mqtt_subscribe.c | 3 + tests/net/mgmt/prj.conf | 1 - tests/net/mgmt/src/mgmt.c | 3 + tests/net/mld/prj.conf | 9 --- tests/net/mld/src/main.c | 5 +- tests/net/neighbor/prj.conf | 3 - tests/net/neighbor/src/main.c | 3 + tests/net/net_pkt/prj.conf | 4 -- tests/net/net_pkt/src/main.c | 5 +- tests/net/promiscuous/prj.conf | 3 - tests/net/promiscuous/src/main.c | 7 +- tests/net/ptp/clock/prj.conf | 9 --- tests/net/ptp/clock/src/main.c | 7 +- tests/net/route/prj.conf | 1 - tests/net/route/src/main.c | 5 +- tests/net/rpl/prj.conf | 11 ---- tests/net/rpl/src/main.c | 7 +- tests/net/socket/getaddrinfo/src/main.c | 3 + tests/net/socket/tcp/src/main.c | 3 + tests/net/socket/udp/prj.conf | 4 -- tests/net/socket/udp/src/main.c | 3 + tests/net/tcp/prj.conf | 11 ---- tests/net/tcp/src/main.c | 5 +- tests/net/traffic_class/prj.conf | 8 --- tests/net/traffic_class/src/main.c | 9 ++- tests/net/trickle/prj.conf | 3 - tests/net/trickle/src/main.c | 5 +- tests/net/tx_timestamp/prj.conf | 8 --- tests/net/tx_timestamp/src/main.c | 7 +- tests/net/udp/prj.conf | 6 -- tests/net/udp/src/main.c | 7 +- tests/net/utils/prj.conf | 3 +- tests/net/utils/src/main.c | 3 + tests/net/vlan/prj.conf | 8 --- tests/net/vlan/src/main.c | 7 +- tests/net/websocket/prj.conf | 14 ---- tests/net/websocket/src/main.c | 9 ++- tests/net/websocket/src/server.c | 9 +-- 76 files changed, 188 insertions(+), 282 deletions(-) diff --git a/tests/net/6lo/prj.conf b/tests/net/6lo/prj.conf index 5e3ca74b6e..b32309834a 100644 --- a/tests/net/6lo/prj.conf +++ b/tests/net/6lo/prj.conf @@ -15,12 +15,7 @@ CONFIG_NET_PKT_TX_COUNT=1 CONFIG_NET_BUF_RX_COUNT=3 CONFIG_NET_BUF_TX_COUNT=3 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_NET_LEVEL=2 -CONFIG_SYS_LOG_SHOW_COLOR=y -CONFIG_NET_DEBUG_IF=y -CONFIG_NET_DEBUG_CORE=y -CONFIG_NET_DEBUG_6LO=y -CONFIG_NET_DEBUG_NET_PKT=y +CONFIG_NET_DEFAULT_LOG_LEVEL_WRN=y CONFIG_NET_6LO_CONTEXT=y #Before modifying this value, add respective code in src/main.c diff --git a/tests/net/6lo/src/main.c b/tests/net/6lo/src/main.c index 1fd16e2d2c..c5d42571a5 100644 --- a/tests/net/6lo/src/main.c +++ b/tests/net/6lo/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_6LO_LOG_LEVEL + #include #include #include diff --git a/tests/net/all/prj.conf b/tests/net/all/prj.conf index 5af1a32ffa..8c84768dbc 100644 --- a/tests/net/all/prj.conf +++ b/tests/net/all/prj.conf @@ -4,7 +4,6 @@ # applications. # Generic options that are useful to be active -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_ZTEST=y @@ -12,16 +11,16 @@ CONFIG_ZTEST=y # net_buf options CONFIG_NET_BUF=y CONFIG_NET_BUF_LOG=y -CONFIG_SYS_LOG_NET_BUF_LEVEL=4 +CONFIG_NET_BUF_LOG_LEVEL_DBG=y CONFIG_NET_BUF_WARN_ALLOC_INTERVAL=2 CONFIG_NET_BUF_SIMPLE_LOG=y CONFIG_NET_BUF_POOL_USAGE=y # Core IP options CONFIG_NETWORKING=y -CONFIG_NET_INIT_PRIO=98 CONFIG_NET_SHELL=y CONFIG_NET_IP_ADDR_CHECK=y +CONFIG_NET_HOSTNAME_ENABLE=y # Statistics CONFIG_NET_STATISTICS=y @@ -60,14 +59,14 @@ CONFIG_NET_L2_BT_ZEP1656=y CONFIG_NET_L2_BT_SEC_LEVEL=4 CONFIG_NET_L2_BT_MGMT=y CONFIG_NET_L2_BT_SHELL=y -CONFIG_NET_DEBUG_L2_IEEE802154=y +CONFIG_NET_L2_IEEE802154_LOG_LEVEL_DBG=y CONFIG_NET_DEBUG_L2_IEEE802154_FRAGMENT=y -CONFIG_NET_DEBUG_L2_ETHERNET=y -CONFIG_NET_DEBUG_L2_BT=y +CONFIG_NET_L2_ETHERNET_LOG_LEVEL_DBG=y +CONFIG_NET_L2_BT_LOG_LEVEL_DBG=y # IP offload support CONFIG_NET_OFFLOAD=y -CONFIG_NET_DEBUG_NET_OFFLOAD=y +CONFIG_NET_OFFLOAD_LOG_LEVEL_DBG=y # RPL CONFIG_NET_RPL=y @@ -77,7 +76,7 @@ CONFIG_NET_RPL_MC_ENERGY=y CONFIG_NET_RPL_MOP2=n CONFIG_NET_RPL_MOP3=y CONFIG_NET_RPL_DAO_MAX_RETRANSMISSIONS=2 -CONFIG_NET_DEBUG_RPL=y +CONFIG_NET_RPL_LOG_LEVEL_DBG=y # Routing table CONFIG_NET_MAX_ROUTERS=3 @@ -86,12 +85,12 @@ CONFIG_NET_ROUTE_MCAST=y # TCP CONFIG_NET_TCP=y -CONFIG_NET_DEBUG_TCP=y +CONFIG_NET_TCP_LOG_LEVEL_DBG=y CONFIG_NET_TCP_TIME_WAIT_DELAY=20000 # UDP CONFIG_NET_UDP=y -CONFIG_NET_DEBUG_UDP=y +CONFIG_NET_UDP_LOG_LEVEL_DBG=y # Network context CONFIG_NET_MAX_CONN=10 @@ -105,7 +104,7 @@ CONFIG_NET_CONTEXT_CHECK=y # Trickle algo CONFIG_NET_TRICKLE=y -CONFIG_NET_DEBUG_TRICKLE=y +CONFIG_NET_TRICKLE_LOG_LEVEL_DBG=y # Network buffer CONFIG_NET_PKT_RX_COUNT=10 @@ -130,15 +129,15 @@ CONFIG_NET_IPV6_NBR_CACHE=y CONFIG_NET_IPV6_ND=y CONFIG_NET_IPV6_DAD=y CONFIG_NET_IPV6_RA_RDNSS=y -CONFIG_NET_DEBUG_IPV6=y -CONFIG_NET_DEBUG_ICMPV6=y -CONFIG_NET_DEBUG_IPV6_NBR_CACHE=y +CONFIG_NET_IPV6_LOG_LEVEL_DBG=y +CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL_DBG=y +CONFIG_NET_ICMPV6_LOG_LEVEL_DBG=y # 6lo CONFIG_NET_6LO=y CONFIG_NET_6LO_CONTEXT=y CONFIG_NET_MAX_6LO_CONTEXTS=2 -CONFIG_NET_DEBUG_6LO=y +CONFIG_NET_6LO_LOG_LEVEL_DBG=y # Sample application generic options CONFIG_NET_CONFIG_SETTINGS=y @@ -160,7 +159,7 @@ CONFIG_NET_MGMT_EVENT=y CONFIG_NET_MGMT_EVENT_STACK_SIZE=800 CONFIG_NET_MGMT_EVENT_THREAD_PRIO=66 CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=2 -CONFIG_NET_DEBUG_MGMT_EVENT=y +CONFIG_NET_MGMT_EVENT_LOG_LEVEL_DBG=y CONFIG_NET_DEBUG_MGMT_EVENT_STACK=y # IPv4 @@ -170,27 +169,26 @@ CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2 CONFIG_NET_IF_MCAST_IPV4_ADDR_COUNT=2 CONFIG_NET_DHCPV4=y CONFIG_NET_IPV4_AUTO=y -CONFIG_NET_DEBUG_IPV4=y -CONFIG_NET_DEBUG_ICMPV4=y -CONFIG_NET_DEBUG_DHCPV4=y +CONFIG_NET_IPV4_LOG_LEVEL_DBG=y +CONFIG_NET_IPV4_AUTO_LOG_LEVEL_DBG=y +CONFIG_NET_ICMPV4_LOG_LEVEL_DBG=y +CONFIG_NET_DHCPV4_LOG_LEVEL_DBG=y # ARP CONFIG_NET_ARP=y CONFIG_NET_ARP_TABLE_SIZE=3 -CONFIG_NET_DEBUG_ARP=y +CONFIG_NET_ARP_LOG_LEVEL_DBG=y # Logging CONFIG_NET_LOG=y -CONFIG_SYS_LOG_NET_LEVEL=4 -CONFIG_NET_LOG_GLOBAL=y -CONFIG_NET_DEBUG_CORE=y -CONFIG_NET_DEBUG_IF=y -CONFIG_NET_DEBUG_UTILS=y -CONFIG_NET_DEBUG_CONTEXT=y -CONFIG_NET_DEBUG_NET_PKT=y +CONFIG_NET_CORE_LOG_LEVEL_DBG=y +CONFIG_NET_IF_LOG_LEVEL_DBG=y +CONFIG_NET_UTILS_LOG_LEVEL_DBG=y +CONFIG_NET_CONTEXT_LOG_LEVEL_DBG=y +CONFIG_NET_PKT_LOG_LEVEL_DBG=y CONFIG_NET_DEBUG_NET_PKT_EXTERNALS=4 -CONFIG_NET_DEBUG_CONN=y -CONFIG_NET_DEBUG_ROUTE=y +CONFIG_NET_CONN_LOG_LEVEL_DBG=y +CONFIG_NET_ROUTE_LOG_LEVEL_DBG=y # IP threads stack size CONFIG_NET_TX_STACK_SIZE=1024 @@ -209,10 +207,15 @@ CONFIG_DNS_SERVER3="192.0.2.42" CONFIG_DNS_SERVER4="2001:db8::2" CONFIG_DNS_SERVER5="192.0.2.11:1000" CONFIG_DNS_NUM_CONCUR_QUERIES=2 -CONFIG_NET_DEBUG_DNS_RESOLVE=y +CONFIG_DNS_RESOLVER_LOG_LEVEL_DBG=y +CONFIG_MDNS_RESPONDER=y +CONFIG_MDNS_RESPONDER_LOG_LEVEL_DBG=y +CONFIG_LLMNR_RESPONDER=y +CONFIG_LLMNR_RESPONDER_LOG_LEVEL_DBG=y # CoAP CONFIG_COAP=y +CONFIG_COAP_LOG_LEVEL_DBG=y # MQTT CONFIG_MQTT_LIB=y @@ -226,6 +229,7 @@ CONFIG_HTTP_SERVER=y CONFIG_HTTP_CLIENT=y CONFIG_HTTP_PARSER=y CONFIG_HTTP_PARSER_STRICT=y +CONFIG_HTTP_LOG_LEVEL_DBG=y # VLAN CONFIG_NET_VLAN=y @@ -233,4 +237,4 @@ CONFIG_NET_VLAN=y # gPTP CONFIG_NET_GPTP=y CONFIG_NET_GPTP_STATISTICS=y -CONFIG_NET_DEBUG_GPTP=y +CONFIG_NET_GPTP_LOG_LEVEL_DBG=y diff --git a/tests/net/all/src/main.c b/tests/net/all/src/main.c index 3958b412a5..7ecd1046cb 100644 --- a/tests/net/all/src/main.c +++ b/tests/net/all/src/main.c @@ -10,6 +10,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL LOG_LEVEL_DBG + #include #include diff --git a/tests/net/app/prj.conf b/tests/net/app/prj.conf index 4780555d61..0cf4ca65dd 100644 --- a/tests/net/app/prj.conf +++ b/tests/net/app/prj.conf @@ -8,7 +8,6 @@ CONFIG_NET_DHCPV4=n CONFIG_NET_MAX_CONTEXTS=10 CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -30,6 +29,3 @@ CONFIG_NET_CONFIG_SETTINGS=y CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1" CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" CONFIG_ZTEST=y -#CONFIG_NET_DEBUG_APP=y -#CONFIG_SYS_LOG_NET_LEVEL=4 -#CONFIG_NET_SHELL=y diff --git a/tests/net/app/src/main.c b/tests/net/app/src/main.c index 7622c6feb1..625c635b7b 100644 --- a/tests/net/app/src/main.c +++ b/tests/net/app/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_APP_LOG_LEVEL + #include #include #include @@ -26,7 +29,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_IF) +#if defined(CONFIG_NET_APP_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/arp/prj.conf b/tests/net/arp/prj.conf index ca7df7fc51..a45a27fe3a 100644 --- a/tests/net/arp/prj.conf +++ b/tests/net/arp/prj.conf @@ -10,14 +10,8 @@ CONFIG_NET_PKT_TX_COUNT=10 CONFIG_NET_BUF_RX_COUNT=20 CONFIG_NET_BUF_TX_COUNT=20 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=3 -CONFIG_NET_DEBUG_ARP=y -CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_NET_DEBUG_IF=y -CONFIG_NET_DEBUG_CORE=y -CONFIG_NET_DEBUG_L2_ETHERNET=y CONFIG_NET_IPV6=n CONFIG_ZTEST=y diff --git a/tests/net/arp/src/main.c b/tests/net/arp/src/main.c index f3e4fccec2..631919330b 100644 --- a/tests/net/arp/src/main.c +++ b/tests/net/arp/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_ARP_LOG_LEVEL + #include #include diff --git a/tests/net/buf/prj.conf b/tests/net/buf/prj.conf index 11302327c4..47e462402b 100644 --- a/tests/net/buf/prj.conf +++ b/tests/net/buf/prj.conf @@ -2,5 +2,5 @@ CONFIG_NET_BUF=y CONFIG_NET_TEST=y CONFIG_HEAP_MEM_POOL_SIZE=4096 #CONFIG_NET_BUF_LOG=y -#CONFIG_SYS_LOG_NET_BUF_LEVEL=4 +#CONFIG_NET_BUF_LOG_LEVEL_DBG=y CONFIG_ZTEST=y diff --git a/tests/net/checksum_offload/prj.conf b/tests/net/checksum_offload/prj.conf index e2d1395cae..7e2c831078 100644 --- a/tests/net/checksum_offload/prj.conf +++ b/tests/net/checksum_offload/prj.conf @@ -8,7 +8,6 @@ CONFIG_NET_ARP=n CONFIG_NET_MAX_CONTEXTS=4 CONFIG_NET_L2_ETHERNET=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -24,14 +23,6 @@ CONFIG_NET_IPV6_ND=n CONFIG_ZTEST=y CONFIG_NET_APP=n CONFIG_NET_CONFIG_SETTINGS=n -CONFIG_NET_DEBUG_L2_ETHERNET=n -CONFIG_NET_DEBUG_CONTEXT=n -CONFIG_NET_DEBUG_IF=n -CONFIG_NET_DEBUG_CORE=n -CONFIG_NET_DEBUG_IPV6=n -CONFIG_NET_DEBUG_IPV4=n -CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_SYS_LOG_NET_LEVEL=4 CONFIG_NET_SHELL=n # Disable internal ethernet drivers as the test is self contained diff --git a/tests/net/checksum_offload/src/main.c b/tests/net/checksum_offload/src/main.c index 5deb243c4b..c914f5d1cc 100644 --- a/tests/net/checksum_offload/src/main.c +++ b/tests/net/checksum_offload/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_L2_ETHERNET_LOG_LEVEL + #include #include #include @@ -28,7 +31,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -279,7 +282,7 @@ struct user_data { int total_if_count; }; -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) { #ifdef CONFIG_NET_L2_ETHERNET diff --git a/tests/net/context/prj.conf b/tests/net/context/prj.conf index bdd5778ce8..2b759c7e00 100644 --- a/tests/net/context/prj.conf +++ b/tests/net/context/prj.conf @@ -9,7 +9,6 @@ CONFIG_NET_CONTEXT_CHECK=y CONFIG_NET_CONTEXT_SYNC_RECV=y CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_ND=n @@ -20,12 +19,4 @@ CONFIG_NET_PKT_TX_COUNT=10 CONFIG_NET_PKT_RX_COUNT=5 CONFIG_NET_BUF_RX_COUNT=10 CONFIG_NET_BUF_TX_COUNT=10 -#CONFIG_SYS_LOG_NET_LEVEL=4 -#CONFIG_NET_DEBUG_IPV6=y -#CONFIG_NET_DEBUG_CONTEXT=y -#CONFIG_NET_DEBUG_CORE=y -#CONFIG_NET_DEBUG_IF=y -#CONFIG_NET_DEBUG_UTILS=y -#CONFIG_NET_DEBUG_NET_PKT=y -#CONFIG_NET_DEBUG_CONN=y CONFIG_ZTEST=y diff --git a/tests/net/context/src/main.c b/tests/net/context/src/main.c index 9dc8222277..de2f2bdba3 100644 --- a/tests/net/context/src/main.c +++ b/tests/net/context/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_CONTEXT_LOG_LEVEL + #include #include #include @@ -26,7 +29,7 @@ #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_CONTEXT) +#if defined(CONFIG_NET_CONTEXT_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/dhcpv4/prj.conf b/tests/net/dhcpv4/prj.conf index fd6edfc837..44eb5a4df3 100644 --- a/tests/net/dhcpv4/prj.conf +++ b/tests/net/dhcpv4/prj.conf @@ -9,21 +9,11 @@ CONFIG_NET_PKT_TX_COUNT=4 CONFIG_NET_BUF_RX_COUNT=7 CONFIG_NET_BUF_TX_COUNT=7 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1 -CONFIG_NET_DEBUG_IF=y -CONFIG_NET_DEBUG_CORE=y -CONFIG_NET_DEBUG_ICMPV4=y -CONFIG_NET_DEBUG_DHCPV4=y -CONFIG_NET_DEBUG_IPV4=y -CONFIG_NET_DEBUG_CONN=y CONFIG_NET_IPV4=y CONFIG_NET_IPV6=n -#CONFIG_NET_DEBUG_L2_ETHERNET=y -#CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_SYS_LOG_NET_LEVEL=2 CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y diff --git a/tests/net/dhcpv4/src/main.c b/tests/net/dhcpv4/src/main.c index a347b9eadb..6170b9dbe2 100644 --- a/tests/net/dhcpv4/src/main.c +++ b/tests/net/dhcpv4/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_DHCPV4_LOG_LEVEL + #include #include diff --git a/tests/net/ethernet_mgmt/prj.conf b/tests/net/ethernet_mgmt/prj.conf index b8fbd6fbce..3dcf5674aa 100644 --- a/tests/net/ethernet_mgmt/prj.conf +++ b/tests/net/ethernet_mgmt/prj.conf @@ -4,7 +4,6 @@ CONFIG_MAIN_STACK_SIZE=2048 CONFIG_NETWORKING=y CONFIG_NET_TEST=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y CONFIG_NET_L2_ETHERNET=y diff --git a/tests/net/ethernet_mgmt/src/main.c b/tests/net/ethernet_mgmt/src/main.c index 03dcbaf150..f5c2097d65 100644 --- a/tests/net/ethernet_mgmt/src/main.c +++ b/tests/net/ethernet_mgmt/src/main.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_L2_ETHERNET_LOG_LEVEL + #include #include diff --git a/tests/net/icmpv6/prj.conf b/tests/net/icmpv6/prj.conf index 5dc3879ebe..9a5e878f34 100644 --- a/tests/net/icmpv6/prj.conf +++ b/tests/net/icmpv6/prj.conf @@ -9,7 +9,6 @@ CONFIG_NET_PKT_TX_COUNT=2 CONFIG_NET_BUF_RX_COUNT=5 CONFIG_NET_BUF_TX_COUNT=5 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_ZTEST=y diff --git a/tests/net/icmpv6/src/main.c b/tests/net/icmpv6/src/main.c index 650b7615f1..b240cb6e2a 100644 --- a/tests/net/icmpv6/src/main.c +++ b/tests/net/icmpv6/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_ICMPV6_LOG_LEVEL + #include #include #include diff --git a/tests/net/ieee802154/crypto/prj.conf b/tests/net/ieee802154/crypto/prj.conf index 2386edd9b5..f6db90e1de 100644 --- a/tests/net/ieee802154/crypto/prj.conf +++ b/tests/net/ieee802154/crypto/prj.conf @@ -11,30 +11,16 @@ CONFIG_NET_IPV6=y CONFIG_NET_IPV6_RA_RDNSS=y CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=2 -CONFIG_NET_DEBUG_6LO=y - CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_INIT_STACKS=y CONFIG_PRINTK=y -CONFIG_NET_DEBUG_CORE=y -CONFIG_NET_DEBUG_IPV6_NBR_CACHE=y -CONFIG_NET_DEBUG_IPV6=y -CONFIG_NET_DEBUG_CONTEXT=y -CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_NET_DEBUG_UTILS=y -CONFIG_NET_DEBUG_IF=y -CONFIG_NET_DEBUG_ICMPV6=y -CONFIG_NET_DEBUG_CONN=y CONFIG_NET_STATISTICS=y CONFIG_NET_L2_IEEE802154=y -CONFIG_NET_DEBUG_L2_IEEE802154=y CONFIG_NET_L2_IEEE802154_RFD=y CONFIG_IEEE802154_CC2520=y -CONFIG_SYS_LOG_IEEE802154_DRIVER_LEVEL=4 CONFIG_NET_L2_IEEE802154_SHELL=y diff --git a/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c b/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c index a5c566b528..81c2207289 100644 --- a/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c +++ b/tests/net/ieee802154/crypto/src/ieee802154_crypto_test.c @@ -4,11 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if 1 -#define SYS_LOG_DOMAIN "15.4 crypto" -#define NET_SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG -#define NET_LOG_ENABLED 1 -#endif +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL LOG_LEVEL_DBG #include #include diff --git a/tests/net/ieee802154/fragment/prj.conf b/tests/net/ieee802154/fragment/prj.conf index d11330990d..4681bf8339 100644 --- a/tests/net/ieee802154/fragment/prj.conf +++ b/tests/net/ieee802154/fragment/prj.conf @@ -16,9 +16,3 @@ CONFIG_NET_BUF_RX_COUNT=35 CONFIG_NET_BUF_TX_COUNT=35 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y -CONFIG_NET_DEBUG_IF=y -CONFIG_NET_DEBUG_CORE=y -CONFIG_NET_DEBUG_6LO=n -CONFIG_NET_DEBUG_L2_IEEE802154_FRAGMENT=y -CONFIG_NET_DEBUG_NET_PKT=n diff --git a/tests/net/ieee802154/fragment/src/main.c b/tests/net/ieee802154/fragment/src/main.c index fa300ba2cf..f0e1685624 100644 --- a/tests/net/ieee802154/fragment/src/main.c +++ b/tests/net/ieee802154/fragment/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL + #include #include diff --git a/tests/net/ieee802154/l2/prj.conf b/tests/net/ieee802154/l2/prj.conf index 566c849117..1e24f94c3d 100644 --- a/tests/net/ieee802154/l2/prj.conf +++ b/tests/net/ieee802154/l2/prj.conf @@ -3,7 +3,6 @@ CONFIG_NET_TEST=y CONFIG_NET_BUF=y CONFIG_NET_IPV6=y CONFIG_NET_L2_IEEE802154=y -CONFIG_NET_DEBUG_L2_IEEE802154=y CONFIG_NET_L2_IEEE802154_SECURITY=y CONFIG_NET_L2_IEEE802154_ACK_REPLY=y CONFIG_MAIN_STACK_SIZE=2048 @@ -12,9 +11,7 @@ CONFIG_NET_PKT_TX_COUNT=5 CONFIG_NET_BUF_RX_COUNT=10 CONFIG_NET_BUF_TX_COUNT=10 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_NET_LEVEL=1 -CONFIG_SYS_LOG_SHOW_COLOR=y +CONFIG_NET_LOG_NET_DEFAULT=2 CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_NET_DEBUG_IPV6=y CONFIG_ZTEST=y diff --git a/tests/net/iface/prj.conf b/tests/net/iface/prj.conf index 1cf65ab16a..171db45b26 100644 --- a/tests/net/iface/prj.conf +++ b/tests/net/iface/prj.conf @@ -9,7 +9,6 @@ CONFIG_NET_L2_DUMMY=y CONFIG_NET_L2_ETHERNET=y CONFIG_NET_L2_ETHERNET_MGMT=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -24,5 +23,3 @@ CONFIG_NET_MAX_NEXTHOPS=8 CONFIG_NET_IPV6_MAX_NEIGHBORS=8 CONFIG_NET_IPV6_ND=n CONFIG_ZTEST=y -#CONFIG_NET_DEBUG_IF=y -#CONFIG_SYS_LOG_NET_LEVEL=4 diff --git a/tests/net/iface/src/main.c b/tests/net/iface/src/main.c index bd9de179f1..4e01798d69 100644 --- a/tests/net/iface/src/main.c +++ b/tests/net/iface/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_IF_LOG_LEVEL + #include #include #include @@ -24,7 +27,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_IF) +#if defined(CONFIG_NET_IF_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -263,7 +266,7 @@ static int eth_fake_init(struct device *dev) ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs, 1500); -#if defined(CONFIG_NET_DEBUG_IF) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) { if (net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET)) { diff --git a/tests/net/ip-addr/prj.conf b/tests/net/ip-addr/prj.conf index d28a5dc4eb..648b6ef4cc 100644 --- a/tests/net/ip-addr/prj.conf +++ b/tests/net/ip-addr/prj.conf @@ -11,7 +11,6 @@ CONFIG_NET_PKT_TX_COUNT=2 CONFIG_NET_BUF_RX_COUNT=5 CONFIG_NET_BUF_TX_COUNT=5 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3 diff --git a/tests/net/ip-addr/src/main.c b/tests/net/ip-addr/src/main.c index c5c21fef2f..f520c54e29 100644 --- a/tests/net/ip-addr/src/main.c +++ b/tests/net/ip-addr/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL + #include #include #include @@ -23,7 +26,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_IPV6) || defined(CONFIG_NET_DEBUG_IPV4) +#if defined(CONFIG_NET_IPV6_LOG_LEVEL) || defined(CONFIG_NET_IPV4_LOG_LEVEL) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/ipv6/prj.conf b/tests/net/ipv6/prj.conf index 497164cad5..0a62b8952f 100644 --- a/tests/net/ipv6/prj.conf +++ b/tests/net/ipv6/prj.conf @@ -9,7 +9,6 @@ CONFIG_NET_TCP=n CONFIG_NET_IPV4=n CONFIG_NET_L2_ETHERNET=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_ND=y @@ -24,12 +23,4 @@ CONFIG_NET_MAX_ROUTERS=2 CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=9 CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=7 CONFIG_NET_IF_IPV6_PREFIX_COUNT=3 -CONFIG_SYS_LOG_NET_LEVEL=2 -#CONFIG_NET_DEBUG_IF=y -#CONFIG_NET_DEBUG_CORE=y -#CONFIG_NET_DEBUG_IPV6=y -#CONFIG_NET_DEBUG_ICMPV6=y -#CONFIG_NET_DEBUG_L2_ETHERNET=y -#CONFIG_NET_DEBUG_UTILS=y -#CONFIG_NET_DEBUG_NET_PKT=y -#CONFIG_NET_DEBUG_6LO=y +CONFIG_NET_DEFAULT_LOG_LEVEL_WRN=y diff --git a/tests/net/ipv6/src/main.c b/tests/net/ipv6/src/main.c index 2ba7596e45..e55085250d 100644 --- a/tests/net/ipv6/src/main.c +++ b/tests/net/ipv6/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL + #include #include #include @@ -15,9 +18,9 @@ #include +#include #include #include -#include #include #include "icmpv6.h" diff --git a/tests/net/ipv6_fragment/prj.conf b/tests/net/ipv6_fragment/prj.conf index 0842b5da36..017cf9be74 100644 --- a/tests/net/ipv6_fragment/prj.conf +++ b/tests/net/ipv6_fragment/prj.conf @@ -7,7 +7,6 @@ CONFIG_NET_IPV4=n CONFIG_NET_MAX_CONTEXTS=4 CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -24,14 +23,6 @@ CONFIG_NET_IPV6_FRAGMENT=y CONFIG_ZTEST=y -CONFIG_SYS_LOG_NET_LEVEL=4 -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_INIT_STACKS=y CONFIG_PRINTK=y CONFIG_NET_STATISTICS=n - -CONFIG_NET_DEBUG_IF=n -CONFIG_NET_DEBUG_CONN=n -CONFIG_NET_DEBUG_IPV6=n -CONFIG_NET_DEBUG_ICMPV6=n -CONFIG_NET_DEBUG_CORE=n diff --git a/tests/net/ipv6_fragment/src/main.c b/tests/net/ipv6_fragment/src/main.c index cd4bfbc7f3..8707264ec8 100644 --- a/tests/net/ipv6_fragment/src/main.c +++ b/tests/net/ipv6_fragment/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL + #include #include #include @@ -27,7 +30,7 @@ #include "ipv6.h" #include "udp_internal.h" -#if defined(CONFIG_NET_DEBUG_IPV6) +#if defined(CONFIG_NET_IPV6_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/lib/coap/prj.conf b/tests/net/lib/coap/prj.conf index 425ece3188..fd812a1533 100644 --- a/tests/net/lib/coap/prj.conf +++ b/tests/net/lib/coap/prj.conf @@ -6,7 +6,6 @@ CONFIG_NET_UDP=y CONFIG_NET_TCP=n CONFIG_NET_IPV4=n CONFIG_NET_BUF_LOG=y -CONFIG_SYS_LOG_NET_BUF_LEVEL=2 CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_COAP=y diff --git a/tests/net/lib/coap/src/main.c b/tests/net/lib/coap/src/main.c index d5e00aa0c5..4c572931d2 100644 --- a/tests/net/lib/coap/src/main.c +++ b/tests/net/lib/coap/src/main.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_COAP_LOG_LEVEL + #include #include #include diff --git a/tests/net/lib/dns_resolve/prj-no-ipv6.conf b/tests/net/lib/dns_resolve/prj-no-ipv6.conf index 4d433856e9..8fc1f5d908 100644 --- a/tests/net/lib/dns_resolve/prj-no-ipv6.conf +++ b/tests/net/lib/dns_resolve/prj-no-ipv6.conf @@ -14,9 +14,6 @@ CONFIG_DNS_SERVER1="192.0.2.2" CONFIG_DNS_SERVER2="192.0.2.2:5353" CONFIG_NET_LOG=y -CONFIG_SYS_LOG_NET_LEVEL=2 -CONFIG_SYS_LOG_SHOW_COLOR=y -#CONFIG_NET_DEBUG_DNS_RESOLVE=y CONFIG_NET_IPV4=y CONFIG_NET_IPV6=n diff --git a/tests/net/lib/dns_resolve/prj.conf b/tests/net/lib/dns_resolve/prj.conf index 4922a77928..0ce99bfad1 100644 --- a/tests/net/lib/dns_resolve/prj.conf +++ b/tests/net/lib/dns_resolve/prj.conf @@ -16,9 +16,6 @@ CONFIG_DNS_SERVER3="192.0.2.2:5353" CONFIG_DNS_SERVER4="[2001:db8::2]:5353" CONFIG_NET_LOG=y -CONFIG_SYS_LOG_NET_LEVEL=2 -CONFIG_SYS_LOG_SHOW_COLOR=y -#CONFIG_NET_DEBUG_DNS_RESOLVE=y CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y diff --git a/tests/net/lib/dns_resolve/src/main.c b/tests/net/lib/dns_resolve/src/main.c index c7693bb762..f8cce4b739 100644 --- a/tests/net/lib/dns_resolve/src/main.c +++ b/tests/net/lib/dns_resolve/src/main.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_DNS_RESOLVER_LOG_LEVEL + #include #include #include @@ -22,7 +25,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_DNS_RESOLVE) +#if defined(CONFIG_DNS_RESOLVER_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c b/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c index 9ae593a68d..7631eaf2b1 100644 --- a/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c +++ b/tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL LOG_LEVEL_WRN + #include #include diff --git a/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c b/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c index 6b64735099..fcecd25cd0 100644 --- a/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c +++ b/tests/net/lib/mqtt_subscriber/src/test_mqtt_subscribe.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL LOG_LEVEL_WRN + #include #include diff --git a/tests/net/mgmt/prj.conf b/tests/net/mgmt/prj.conf index 012660a963..9ae516d6e6 100644 --- a/tests/net/mgmt/prj.conf +++ b/tests/net/mgmt/prj.conf @@ -9,7 +9,6 @@ CONFIG_NET_PKT_TX_COUNT=5 CONFIG_NET_BUF_RX_COUNT=5 CONFIG_NET_BUF_TX_COUNT=5 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_MGMT=y diff --git a/tests/net/mgmt/src/mgmt.c b/tests/net/mgmt/src/mgmt.c index e73622cc27..79edd23fed 100644 --- a/tests/net/mgmt/src/mgmt.c +++ b/tests/net/mgmt/src/mgmt.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_MGMT_EVENT_LOG_LEVEL + #include #include #include diff --git a/tests/net/mld/prj.conf b/tests/net/mld/prj.conf index 2a66316997..7b04f0aec9 100644 --- a/tests/net/mld/prj.conf +++ b/tests/net/mld/prj.conf @@ -8,7 +8,6 @@ CONFIG_NET_TCP=n CONFIG_NET_IPV4=n CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_ND=y @@ -22,11 +21,3 @@ CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=4 CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=4 -#CONFIG_NET_DEBUG_MGMT_EVENT=y -#CONFIG_NET_DEBUG_IF=y -#CONFIG_NET_DEBUG_CORE=y -#CONFIG_NET_DEBUG_IPV6=y -#CONFIG_NET_DEBUG_ICMPV6=y -#CONFIG_NET_DEBUG_UTILS=y -#CONFIG_NET_DEBUG_NET_PKT=y -#CONFIG_SYS_LOG_NET_LEVEL=4 diff --git a/tests/net/mld/src/main.c b/tests/net/mld/src/main.c index f56345e75e..0bba478eae 100644 --- a/tests/net/mld/src/main.c +++ b/tests/net/mld/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL + #include #include #include @@ -29,7 +32,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_IPV6) +#if defined(CONFIG_NET_IPV6_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/neighbor/prj.conf b/tests/net/neighbor/prj.conf index 6466527627..9b0844ee27 100644 --- a/tests/net/neighbor/prj.conf +++ b/tests/net/neighbor/prj.conf @@ -9,11 +9,8 @@ CONFIG_NET_BUF_RX_COUNT=7 CONFIG_NET_BUF_TX_COUNT=7 CONFIG_NET_BUF_DATA_SIZE=128 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=3 -CONFIG_NET_DEBUG_IF=y -CONFIG_NET_DEBUG_CORE=y CONFIG_NET_IPV6_MAX_NEIGHBORS=4 CONFIG_ZTEST=y diff --git a/tests/net/neighbor/src/main.c b/tests/net/neighbor/src/main.c index f58e5d9997..39b7df6ebc 100644 --- a/tests/net/neighbor/src/main.c +++ b/tests/net/neighbor/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL + #include #include #include diff --git a/tests/net/net_pkt/prj.conf b/tests/net/net_pkt/prj.conf index 9ba7db3805..aaef4317ba 100644 --- a/tests/net/net_pkt/prj.conf +++ b/tests/net/net_pkt/prj.conf @@ -3,7 +3,6 @@ CONFIG_NET_TEST=y CONFIG_NET_IPV6=y CONFIG_NET_BUF=y CONFIG_NET_BUF_LOG=y -CONFIG_SYS_LOG_NET_BUF_LEVEL=2 CONFIG_MAIN_STACK_SIZE=2048 CONFIG_NET_PKT_RX_COUNT=4 CONFIG_NET_PKT_TX_COUNT=4 @@ -13,9 +12,6 @@ CONFIG_NET_BUF_TX_COUNT=34 # it without fixing the tests. CONFIG_NET_BUF_DATA_SIZE=100 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_NET_LEVEL=1 -CONFIG_SYS_LOG_SHOW_COLOR=y -#CONFIG_NET_DEBUG_NET_PKT=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_ZTEST=y diff --git a/tests/net/net_pkt/src/main.c b/tests/net/net_pkt/src/main.c index 99f243a45f..9216f6bc69 100644 --- a/tests/net/net_pkt/src/main.c +++ b/tests/net/net_pkt/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_PKT_LOG_LEVEL + #include #include #include @@ -17,7 +20,7 @@ #include #include -#if defined(CONFIG_NET_DEBUG_NET_PKT) +#if defined(CONFIG_NET_NET_PKT_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #define NET_LOG_ENABLED 1 #else diff --git a/tests/net/promiscuous/prj.conf b/tests/net/promiscuous/prj.conf index c4410c60a1..5f56de6e98 100644 --- a/tests/net/promiscuous/prj.conf +++ b/tests/net/promiscuous/prj.conf @@ -9,7 +9,6 @@ CONFIG_NET_L2_ETHERNET=y CONFIG_NET_L2_ETHERNET_MGMT=y CONFIG_NET_PROMISCUOUS_MODE=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -23,5 +22,3 @@ CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=6 CONFIG_NET_IPV6_MAX_NEIGHBORS=1 CONFIG_NET_IPV6_ND=n CONFIG_ZTEST=y -#CONFIG_NET_DEBUG_IF=y -#CONFIG_SYS_LOG_NET_LEVEL=4 diff --git a/tests/net/promiscuous/src/main.c b/tests/net/promiscuous/src/main.c index cb0b928eae..b9565eaf3b 100644 --- a/tests/net/promiscuous/src/main.c +++ b/tests/net/promiscuous/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_IF_LOG_LEVEL + #include #include #include @@ -23,7 +26,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_IF) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -144,7 +147,7 @@ ETH_NET_DEVICE_INIT(eth_fake1, "eth_fake1", eth_fake_init, ð_fake_data1, ETH_NET_DEVICE_INIT(eth_fake2, "eth_fake2", eth_fake_init, ð_fake_data2, NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs, 1500); -#if defined(CONFIG_NET_DEBUG_IF) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) { if (net_if_l2(iface) == &NET_L2_GET_NAME(ETHERNET)) { diff --git a/tests/net/ptp/clock/prj.conf b/tests/net/ptp/clock/prj.conf index 13c1486a1f..2d61cba280 100644 --- a/tests/net/ptp/clock/prj.conf +++ b/tests/net/ptp/clock/prj.conf @@ -7,7 +7,6 @@ CONFIG_NET_IPV4=n CONFIG_NET_MAX_CONTEXTS=4 CONFIG_NET_L2_ETHERNET=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -22,14 +21,6 @@ CONFIG_NET_IPV6_ND=n CONFIG_ZTEST=y CONFIG_NET_APP=n CONFIG_NET_CONFIG_SETTINGS=n -CONFIG_NET_DEBUG_L2_ETHERNET=n -CONFIG_NET_DEBUG_CONTEXT=n -CONFIG_NET_DEBUG_IF=n -CONFIG_NET_DEBUG_CORE=n -CONFIG_NET_DEBUG_IPV6=n -CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_SYS_LOG_NET_LEVEL=4 CONFIG_NET_SHELL=n CONFIG_PTP_CLOCK=y CONFIG_ETH_NATIVE_POSIX=n - diff --git a/tests/net/ptp/clock/src/main.c b/tests/net/ptp/clock/src/main.c index eea9261783..31366f964f 100644 --- a/tests/net/ptp/clock/src/main.c +++ b/tests/net/ptp/clock/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_L2_ETHERNET_LOG_LEVEL + #include #include #include @@ -27,7 +30,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -252,7 +255,7 @@ struct user_data { int total_if_count; }; -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) { #ifdef CONFIG_NET_L2_ETHERNET diff --git a/tests/net/route/prj.conf b/tests/net/route/prj.conf index 35c8807244..c78b9dbc85 100644 --- a/tests/net/route/prj.conf +++ b/tests/net/route/prj.conf @@ -7,7 +7,6 @@ CONFIG_NET_IPV4=n CONFIG_NET_MAX_CONTEXTS=4 CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n diff --git a/tests/net/route/src/main.c b/tests/net/route/src/main.c index 6a6f56d7a2..c5e9c50a52 100644 --- a/tests/net/route/src/main.c +++ b/tests/net/route/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_ROUTE_LOG_LEVEL + #include #include #include @@ -30,7 +33,7 @@ #include "nbr.h" #include "route.h" -#if defined(CONFIG_NET_DEBUG_ROUTE) +#if defined(CONFIG_NET_ROUTE_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/rpl/prj.conf b/tests/net/rpl/prj.conf index 992238d46c..e61c5c6bb4 100644 --- a/tests/net/rpl/prj.conf +++ b/tests/net/rpl/prj.conf @@ -7,7 +7,6 @@ CONFIG_NET_IPV4=n CONFIG_NET_MAX_CONTEXTS=4 CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_ND=n @@ -23,14 +22,4 @@ CONFIG_NET_RPL_MAX_DAG_PER_INSTANCE=2 CONFIG_NET_RPL_MAX_INSTANCES=3 CONFIG_NET_RPL_PROBING=y CONFIG_NET_STATISTICS_RPL=y -CONFIG_SYS_LOG_NET_LEVEL=4 -#CONFIG_NET_DEBUG_CONTEXT=y -#CONFIG_NET_DEBUG_CORE=y -#CONFIG_NET_DEBUG_UTILS=y -#CONFIG_NET_DEBUG_NET_PKT=y -#CONFIG_NET_DEBUG_CONN=y -#CONFIG_NET_DEBUG_IPV6=y -#CONFIG_NET_DEBUG_IF=y -#CONFIG_NET_DEBUG_UTILS=y -#CONFIG_NET_DEBUG_RPL=y CONFIG_ZTEST=y diff --git a/tests/net/rpl/src/main.c b/tests/net/rpl/src/main.c index 739fe5fa19..6a56f1b21d 100644 --- a/tests/net/rpl/src/main.c +++ b/tests/net/rpl/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_RPL_LOG_LEVEL + #include #include #include @@ -30,7 +33,7 @@ #include "nbr.h" #include "rpl.h" -#if defined(CONFIG_NET_DEBUG_RPL) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -150,7 +153,7 @@ static int tester_send(struct net_if *iface, struct net_pkt *pkt) DBG("pkt %p to be sent len %lu\n", pkt, net_pkt_get_len(pkt)); -#if defined(CONFIG_NET_DEBUG_RPL) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG net_hexdump_frags("recv", pkt, false); #endif diff --git a/tests/net/socket/getaddrinfo/src/main.c b/tests/net/socket/getaddrinfo/src/main.c index 75a0c21934..7cb7c47dff 100644 --- a/tests/net/socket/getaddrinfo/src/main.c +++ b/tests/net/socket/getaddrinfo/src/main.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_SOCKETS_LOG_LEVEL + #include #include diff --git a/tests/net/socket/tcp/src/main.c b/tests/net/socket/tcp/src/main.c index d864e217d1..56512d5b14 100644 --- a/tests/net/socket/tcp/src/main.c +++ b/tests/net/socket/tcp/src/main.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_SOCKETS_LOG_LEVEL + #include #include diff --git a/tests/net/socket/udp/prj.conf b/tests/net/socket/udp/prj.conf index 9245f75baa..202b478496 100644 --- a/tests/net/socket/udp/prj.conf +++ b/tests/net/socket/udp/prj.conf @@ -17,10 +17,6 @@ CONFIG_NET_CONFIG_SETTINGS=y CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1" -# Network debug config -#CONFIG_NET_LOG=y -#CONFIG_NET_DEBUG_SOCKETS=y -#CONFIG_SYS_LOG_NET_LEVEL=4 CONFIG_MAIN_STACK_SIZE=2048 CONFIG_ZTEST=y diff --git a/tests/net/socket/udp/src/main.c b/tests/net/socket/udp/src/main.c index bbffe3f934..662733d6cc 100644 --- a/tests/net/socket/udp/src/main.c +++ b/tests/net/socket/udp/src/main.c @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_SOCKETS_LOG_LEVEL + #include #include diff --git a/tests/net/tcp/prj.conf b/tests/net/tcp/prj.conf index ac358974f2..d2106639d1 100644 --- a/tests/net/tcp/prj.conf +++ b/tests/net/tcp/prj.conf @@ -15,7 +15,6 @@ CONFIG_NET_BUF_RX_COUNT=20 CONFIG_NET_BUF_TX_COUNT=20 CONFIG_NET_MAX_CONTEXTS=20 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IF_MAX_IPV6_COUNT=2 @@ -29,13 +28,3 @@ CONFIG_NET_IPV6_DAD=n CONFIG_NET_IPV6_NBR_CACHE=n CONFIG_NET_IPV6_MLD=n CONFIG_NET_TCP_CHECKSUM=n - -CONFIG_SYS_LOG_NET_LEVEL=2 -#CONFIG_NET_DEBUG_CORE=y -#CONFIG_NET_DEBUG_TCP=y -#CONFIG_NET_DEBUG_IPV6=y -#CONFIG_NET_DEBUG_CONN=y -#CONFIG_NET_DEBUG_NET_PKT=y -#CONFIG_NET_DEBUG_IF=y -#CONFIG_NET_DEBUG_CONTEXT=y -#CONFIG_NET_DEBUG_L2=y diff --git a/tests/net/tcp/src/main.c b/tests/net/tcp/src/main.c index 9f02a4475e..4c27da1eb3 100644 --- a/tests/net/tcp/src/main.c +++ b/tests/net/tcp/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_TCP_LOG_LEVEL + #include #include @@ -24,7 +27,7 @@ #include -#if defined(CONFIG_NET_DEBUG_TCP) +#if defined(CONFIG_NET_TCP_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #define NET_LOG_ENABLED 1 #else diff --git a/tests/net/traffic_class/prj.conf b/tests/net/traffic_class/prj.conf index 60085b241d..b397c52c48 100644 --- a/tests/net/traffic_class/prj.conf +++ b/tests/net/traffic_class/prj.conf @@ -10,7 +10,6 @@ CONFIG_NET_MAX_CONN=8 CONFIG_NET_L2_ETHERNET=y CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_STATISTICS=y @@ -31,13 +30,6 @@ CONFIG_NET_TC_RX_COUNT=8 CONFIG_ZTEST=y CONFIG_NET_APP=n CONFIG_NET_CONFIG_SETTINGS=n -CONFIG_NET_DEBUG_L2_ETHERNET=n -CONFIG_NET_DEBUG_CONTEXT=n -CONFIG_NET_DEBUG_IF=n -CONFIG_NET_DEBUG_CORE=n -CONFIG_NET_DEBUG_IPV6=n -CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_SYS_LOG_NET_LEVEL=4 CONFIG_NET_SHELL=n # We run out of CONFIG_MAX_THREAD_BYTES in qemu. Instead of increasing that diff --git a/tests/net/traffic_class/src/main.c b/tests/net/traffic_class/src/main.c index aa2748a242..2ad53bdc23 100644 --- a/tests/net/traffic_class/src/main.c +++ b/tests/net/traffic_class/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_TC_LOG_LEVEL + #include #include #include @@ -27,7 +30,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -186,7 +189,7 @@ static int eth_tx(struct net_if *iface, struct net_pkt *pkt) } if (test_started) { -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG k_tid_t thread = k_current_get(); #endif int i, prio, ret; @@ -682,7 +685,7 @@ static void recv_cb(struct net_context *context, int status, void *user_data) { -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG k_tid_t thread = k_current_get(); #endif int i, prio, ret; diff --git a/tests/net/trickle/prj.conf b/tests/net/trickle/prj.conf index 4c0dd9ff23..b9a265abfc 100644 --- a/tests/net/trickle/prj.conf +++ b/tests/net/trickle/prj.conf @@ -5,7 +5,6 @@ CONFIG_NET_UDP=y CONFIG_NET_TCP=n CONFIG_NET_IPV4=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_ND=n @@ -15,7 +14,5 @@ CONFIG_NET_PKT_RX_COUNT=2 CONFIG_NET_BUF_RX_COUNT=5 CONFIG_NET_BUF_TX_COUNT=5 CONFIG_NET_TRICKLE=y -#CONFIG_NET_DEBUG_TRICKLE=y -#CONFIG_SYS_LOG_NET_LEVEL=4 CONFIG_ZTEST=y CONFIG_ZTEST_STACKSIZE=1024 diff --git a/tests/net/trickle/src/main.c b/tests/net/trickle/src/main.c index 7388016125..432bc23c6b 100644 --- a/tests/net/trickle/src/main.c +++ b/tests/net/trickle/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_TRICKLE_LOG_LEVEL + #include #include #include @@ -25,7 +28,7 @@ #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_TRICKLE) +#if defined(CONFIG_NET_TRICKLE_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) diff --git a/tests/net/tx_timestamp/prj.conf b/tests/net/tx_timestamp/prj.conf index 4508910680..d9bfe42b20 100644 --- a/tests/net/tx_timestamp/prj.conf +++ b/tests/net/tx_timestamp/prj.conf @@ -7,7 +7,6 @@ CONFIG_NET_IPV4=n CONFIG_NET_MAX_CONTEXTS=4 CONFIG_NET_L2_ETHERNET=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -22,12 +21,5 @@ CONFIG_NET_IPV6_ND=n CONFIG_ZTEST=y CONFIG_NET_APP=n CONFIG_NET_CONFIG_SETTINGS=n -CONFIG_NET_DEBUG_L2_ETHERNET=n -CONFIG_NET_DEBUG_CONTEXT=n -CONFIG_NET_DEBUG_IF=n -CONFIG_NET_DEBUG_CORE=n -CONFIG_NET_DEBUG_IPV6=n -CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_SYS_LOG_NET_LEVEL=4 CONFIG_NET_SHELL=n CONFIG_NET_PKT_TIMESTAMP=y diff --git a/tests/net/tx_timestamp/src/main.c b/tests/net/tx_timestamp/src/main.c index a83ec6eaa9..145bdf29d4 100644 --- a/tests/net/tx_timestamp/src/main.c +++ b/tests/net/tx_timestamp/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_L2_ETHERNET_LOG_LEVEL + #include #include #include @@ -27,7 +30,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -302,7 +305,7 @@ struct user_data { int total_if_count; }; -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) { #ifdef CONFIG_NET_L2_ETHERNET diff --git a/tests/net/udp/prj.conf b/tests/net/udp/prj.conf index 7dc0fc2761..996d5b9fb1 100644 --- a/tests/net/udp/prj.conf +++ b/tests/net/udp/prj.conf @@ -15,16 +15,10 @@ CONFIG_NET_PKT_TX_COUNT=10 CONFIG_NET_BUF_RX_COUNT=15 CONFIG_NET_BUF_TX_COUNT=15 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=2 CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2 -CONFIG_NET_DEBUG_CORE=y -CONFIG_NET_DEBUG_CONN=y -#CONFIG_NET_DEBUG_NET_PKT=y -#CONFIG_NET_DEBUG_IF=y -CONFIG_SYS_LOG_NET_LEVEL=2 # Turn off UDP checksum checking as the test fails otherwise. CONFIG_NET_UDP_CHECKSUM=n diff --git a/tests/net/udp/src/main.c b/tests/net/udp/src/main.c index 3121b92b29..a28e0ae1b9 100644 --- a/tests/net/udp/src/main.c +++ b/tests/net/udp/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_UDP_LOG_LEVEL + #include #include @@ -26,7 +29,7 @@ #include -#if defined(CONFIG_NET_DEBUG_UDP) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -34,7 +37,7 @@ #include "udp_internal.h" -#if defined(CONFIG_NET_DEBUG_UDP) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define NET_LOG_ENABLED 1 #endif #include "net_private.h" diff --git a/tests/net/utils/prj.conf b/tests/net/utils/prj.conf index c758c54f76..3d699c70aa 100644 --- a/tests/net/utils/prj.conf +++ b/tests/net/utils/prj.conf @@ -9,12 +9,11 @@ CONFIG_NET_PKT_TX_COUNT=2 CONFIG_NET_BUF_RX_COUNT=7 CONFIG_NET_BUF_TX_COUNT=7 CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3 -CONFIG_NET_DEBUG_UTILS=y CONFIG_NET_TCP=y CONFIG_NET_UDP=y CONFIG_ZTEST=y CONFIG_MAIN_STACK_SIZE=1280 + diff --git a/tests/net/utils/src/main.c b/tests/net/utils/src/main.c index e0cf9cfa8d..094523b86e 100644 --- a/tests/net/utils/src/main.c +++ b/tests/net/utils/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_UTILS_LOG_LEVEL + #include #include #include diff --git a/tests/net/vlan/prj.conf b/tests/net/vlan/prj.conf index b04260d8df..e3f63fcf20 100644 --- a/tests/net/vlan/prj.conf +++ b/tests/net/vlan/prj.conf @@ -8,7 +8,6 @@ CONFIG_NET_MAX_CONTEXTS=4 CONFIG_NET_L2_ETHERNET=y CONFIG_NET_L2_DUMMY=y CONFIG_NET_LOG=y -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_IPV6_DAD=n @@ -26,13 +25,6 @@ CONFIG_NET_CONTEXT_PRIORITY=y CONFIG_ZTEST=y CONFIG_NET_APP=n CONFIG_NET_CONFIG_SETTINGS=n -CONFIG_NET_DEBUG_L2_ETHERNET=n -CONFIG_NET_DEBUG_CONTEXT=n -CONFIG_NET_DEBUG_IF=n -CONFIG_NET_DEBUG_CORE=n -CONFIG_NET_DEBUG_IPV6=n -CONFIG_NET_DEBUG_NET_PKT=y -CONFIG_SYS_LOG_NET_LEVEL=4 CONFIG_NET_SHELL=n # Disable internal ethernet drivers as the test is self contained diff --git a/tests/net/vlan/src/main.c b/tests/net/vlan/src/main.c index e1f0bf963a..d1f391ffe2 100644 --- a/tests/net/vlan/src/main.c +++ b/tests/net/vlan/src/main.c @@ -6,6 +6,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_NET_L2_ETHERNET_LOG_LEVEL + #include #include #include @@ -27,7 +30,7 @@ #define NET_LOG_ENABLED 1 #include "net_private.h" -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else #define DBG(fmt, ...) @@ -274,7 +277,7 @@ struct user_data { int total_if_count; }; -#if defined(CONFIG_NET_DEBUG_L2_ETHERNET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) { #ifdef CONFIG_NET_L2_ETHERNET diff --git a/tests/net/websocket/prj.conf b/tests/net/websocket/prj.conf index 462a110c60..274ed852aa 100644 --- a/tests/net/websocket/prj.conf +++ b/tests/net/websocket/prj.conf @@ -56,18 +56,4 @@ CONFIG_MBEDTLS_BUILTIN=y # Logging CONFIG_NET_LOG=y -CONFIG_SYS_LOG_NET_LEVEL=2 -CONFIG_SYS_LOG_SHOW_COLOR=y CONFIG_NET_STATISTICS=y - -# Debugging -CONFIG_NET_DEBUG_WEBSOCKET=n -CONFIG_NET_DEBUG_HTTP=n -CONFIG_NET_DEBUG_APP=n -CONFIG_NET_DEBUG_NET_PKT=n -CONFIG_NET_DEBUG_CORE=n -CONFIG_NET_DEBUG_CONTEXT=n -CONFIG_NET_DEBUG_CONN=n -CONFIG_NET_DEBUG_TCP=n -CONFIG_NET_DEBUG_IF=n -CONFIG_NET_DEBUG_IPV6=n diff --git a/tests/net/websocket/src/main.c b/tests/net/websocket/src/main.c index 54b64a7614..bc33d1a432 100644 --- a/tests/net/websocket/src/main.c +++ b/tests/net/websocket/src/main.c @@ -11,6 +11,9 @@ * we get proper data back. */ +#define LOG_MODULE_NAME net_test +#define NET_LOG_LEVEL CONFIG_WEBSOCKET_LOG_LEVEL + #include #include @@ -20,7 +23,7 @@ static struct net_app_ctx app_ctx_v6; static struct net_app_ctx app_ctx_v4; -#if defined(CONFIG_NET_DEBUG_WEBSOCKET) +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #define NET_LOG_ENABLED 1 #else @@ -217,7 +220,7 @@ static void test_send_recv(int chunk_size, struct net_app_ctx *ctx) for (i = 0; i < sizeof(ws_test_msg); i += chunk_size) { for (j = 0; - IS_ENABLED(CONFIG_NET_DEBUG_WEBSOCKET) && j < chunk_size; + (NET_LOG_LEVEL >= LOG_LEVEL_DBG) && j < chunk_size; j++) { if ((i + chunk_size) >= sizeof(ws_test_msg)) { break; @@ -276,7 +279,7 @@ static void test_send_multi_msg(struct net_app_ctx *ctx) for (i = 0; i < sizeof(ws_big_msg); i += chunk_size) { for (j = 0; - IS_ENABLED(CONFIG_NET_DEBUG_WEBSOCKET) && j < chunk_size; + (NET_LOG_LEVEL >= LOG_LEVEL_DBG) && j < chunk_size; j++) { int first_msg = 0; diff --git a/tests/net/websocket/src/server.c b/tests/net/websocket/src/server.c index ff5f0621fe..ef00a80a0f 100644 --- a/tests/net/websocket/src/server.c +++ b/tests/net/websocket/src/server.c @@ -4,11 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if defined(CONFIG_NET_DEBUG_WEBSOCKET) -#define SYS_LOG_DOMAIN "test-ws-server" -#define NET_SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG -#define NET_LOG_ENABLED 1 -#endif +#define LOG_MODULE_NAME net_test_websocket +#define NET_LOG_LEVEL CONFIG_WEBSOCKET_LOG_LEVEL #include #include @@ -240,7 +237,6 @@ static void ws_closed(struct http_ctx *ctx, NET_DBG("Connection %p closed", ctx); } -#if defined(CONFIG_NET_DEBUG_WEBSOCKET) && (NET_SYS_LOG_LEVEL > 3) static const char *get_string(int str_len, const char *str) { static char buf[64]; @@ -251,7 +247,6 @@ static const char *get_string(int str_len, const char *str) return buf; } -#endif static enum http_verdict default_handler(struct http_ctx *ctx, enum http_connection_type type,