net: ip: Improve logging by adding a dedicated sys_log level
Let's make net stack having its own level of debugging through sys_log. It replaces NET_DEBUG by NET_LOG_ENABLED, which is then semantically better: someone wanting to log the errors might want that not only for debugging. Along with it, CONFIG_NET_LOG_GLOBAL option is added, in order to enable all available logging in network stack. It is disabled by default but might be found useful when warning/errors need to be logged, so it is then unnecessary to selectively enable by hand all CONFIG_NET_DEBUG_* options. It is possible, locally, to override CONFIG_SYS_LOG_NET_LEVEL by setting the level one want to NET_SYS_LOG_LEVEL. This can be useful on samples or tests. Change-Id: I56a8f052340bc3a932229963cc69b39912093b88 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
4869dc9786
commit
a1aa08c288
53 changed files with 230 additions and 190 deletions
|
@ -29,15 +29,17 @@ extern "C" {
|
|||
|
||||
/* Network subsystem logging helpers */
|
||||
|
||||
#if defined(CONFIG_NET_LOG)
|
||||
#if NET_DEBUG > 0
|
||||
#if defined(NET_LOG_ENABLED)
|
||||
#if !defined(SYS_LOG_DOMAIN)
|
||||
#define SYS_LOG_DOMAIN "net"
|
||||
#endif /* !SYS_LOG_DOMAIN */
|
||||
|
||||
#undef SYS_LOG_LEVEL
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
|
||||
#endif /* NET_DEBUG */
|
||||
#ifndef NET_SYS_LOG_LEVEL
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_NET_LEVEL
|
||||
#else
|
||||
#define SYS_LOG_LEVEL NET_SYS_LOG_LEVEL
|
||||
#endif /* !NET_SYS_LOG_LEVEL */
|
||||
|
||||
#define NET_DBG(fmt, ...) SYS_LOG_DBG("(%p): " fmt, k_current_get(), \
|
||||
##__VA_ARGS__)
|
||||
|
@ -53,14 +55,14 @@ extern "C" {
|
|||
NET_ERR("{assert: '" #cond "' failed} " fmt, \
|
||||
##__VA_ARGS__); \
|
||||
} } while (0)
|
||||
#else /* CONFIG_NET_LOG */
|
||||
#else /* NET_LOG_ENABLED */
|
||||
#define NET_DBG(...)
|
||||
#define NET_ERR(...)
|
||||
#define NET_INFO(...)
|
||||
#define NET_WARN(...)
|
||||
#define NET_ASSERT(...)
|
||||
#define NET_ASSERT_INFO(...)
|
||||
#endif /* CONFIG_NET_LOG */
|
||||
#endif /* NET_LOG_ENABLED */
|
||||
|
||||
#include <kernel.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue