net: Start to use logging macros from sys_log.h
Instead of directly calling printk/printf, the network printing macros will use syslog macros defined in sys_log.h Change-Id: I3f12f81557f50b24ca47a43f345162f9ffbd574c Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
71f2a78316
commit
f75d8a86bb
3 changed files with 50 additions and 12 deletions
|
@ -29,23 +29,32 @@ extern "C" {
|
||||||
|
|
||||||
/* Network subsystem logging helpers */
|
/* Network subsystem logging helpers */
|
||||||
|
|
||||||
#ifdef CONFIG_NETWORKING_WITH_LOGGING
|
#if defined(CONFIG_NET_LOG)
|
||||||
#define NET_DBG(fmt, ...) printk("net: %s (%p): " fmt, __func__, \
|
#if !defined(SYS_LOG_DOMAIN)
|
||||||
sys_thread_self_get(), ##__VA_ARGS__)
|
#define SYS_LOG_DOMAIN "net"
|
||||||
#define NET_ERR(fmt, ...) printk("net: %s: " fmt, __func__, ##__VA_ARGS__)
|
#endif /* !SYS_LOG_DOMAIN */
|
||||||
#define NET_INFO(fmt, ...) printk("net: " fmt, ##__VA_ARGS__)
|
|
||||||
#define NET_PRINT(fmt, ...) printk(fmt, ##__VA_ARGS__)
|
#if NET_DEBUG > 0
|
||||||
#else
|
#undef SYS_LOG_LEVEL
|
||||||
|
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
|
||||||
|
#endif /* NET_DEBUG */
|
||||||
|
|
||||||
|
#define NET_DBG(fmt, ...) SYS_LOG_DBG("(%p): " fmt, sys_thread_self_get(), \
|
||||||
|
##__VA_ARGS__)
|
||||||
|
#define NET_ERR(fmt, ...) SYS_LOG_ERR(fmt, ##__VA_ARGS__)
|
||||||
|
#define NET_WARN(fmt, ...) SYS_LOG_WRN(fmt, ##__VA_ARGS__)
|
||||||
|
#define NET_INFO(fmt, ...) SYS_LOG_INF(fmt, ##__VA_ARGS__)
|
||||||
|
#else /* CONFIG_NET_LOG */
|
||||||
#define NET_DBG(...)
|
#define NET_DBG(...)
|
||||||
#define NET_ERR(...)
|
#define NET_ERR(...)
|
||||||
#define NET_INFO(...)
|
#define NET_INFO(...)
|
||||||
#define NET_PRINT(...)
|
#define NET_WARN(...)
|
||||||
#endif /* CONFIG_NETWORKING_WITH_LOGGING */
|
#endif /* CONFIG_NET_LOG */
|
||||||
|
|
||||||
struct net_buf;
|
struct net_buf;
|
||||||
struct net_context;
|
struct net_context;
|
||||||
|
|
||||||
#include <misc/printk.h>
|
#include <misc/sys_log.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <net/net_if.h>
|
#include <net/net_if.h>
|
||||||
|
|
|
@ -16,6 +16,17 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
if NET_YAIP
|
||||||
|
menuconfig NET_LOG
|
||||||
|
bool "Enable network stack logging"
|
||||||
|
select STDOUT_CONSOLE
|
||||||
|
select SYS_LOG
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable logging in various parts of the network stack.
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !NET_YAIP
|
||||||
menuconfig NETWORKING_WITH_LOGGING
|
menuconfig NETWORKING_WITH_LOGGING
|
||||||
bool "Enable network stack logging"
|
bool "Enable network stack logging"
|
||||||
select STDOUT_CONSOLE
|
select STDOUT_CONSOLE
|
||||||
|
@ -23,6 +34,7 @@ menuconfig NETWORKING_WITH_LOGGING
|
||||||
help
|
help
|
||||||
Enable logging in various parts of the network stack.
|
Enable logging in various parts of the network stack.
|
||||||
|
|
||||||
|
if NETWORKING_WITH_LOGGING
|
||||||
choice
|
choice
|
||||||
prompt "General debug level"
|
prompt "General debug level"
|
||||||
default NETWORK_IP_STACK_DEBUG_PRINT
|
default NETWORK_IP_STACK_DEBUG_PRINT
|
||||||
|
@ -37,9 +49,25 @@ config NETWORK_IP_STACK_DEBUG_ANNOTATE
|
||||||
config NETWORK_IP_STACK_DEBUG_FULL
|
config NETWORK_IP_STACK_DEBUG_FULL
|
||||||
bool "Print both messages and annotations"
|
bool "Print both messages and annotations"
|
||||||
endchoice
|
endchoice
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if NETWORKING_WITH_LOGGING || NET_LOG
|
if NETWORKING_WITH_LOGGING || NET_LOG
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_CORE
|
||||||
|
bool "Debug core IP stack"
|
||||||
|
depends on NET_YAIP
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables core network stack code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IF
|
||||||
|
bool "Debug network interface code"
|
||||||
|
depends on NET_YAIP
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables network interface code part to output debug messages
|
||||||
|
|
||||||
config NETWORK_IP_STACK_DEBUG_CONTEXT
|
config NETWORK_IP_STACK_DEBUG_CONTEXT
|
||||||
bool "Debug network context allocation"
|
bool "Debug network context allocation"
|
||||||
default n
|
default n
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_CORE
|
#if defined(CONFIG_NETWORK_IP_STACK_DEBUG_CORE)
|
||||||
#define DEBUG 1
|
#define SYS_LOG_DOMAIN "net/core"
|
||||||
|
#define NET_DEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue