net: buf: Convert to new logging system
This commit replaces syslog with new logging subsystem in buf.c Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
a76814bfb6
commit
46bc51d8c1
|
@ -27,24 +27,17 @@ config NET_BUF_USER_DATA_SIZE
|
|||
|
||||
config NET_BUF_LOG
|
||||
bool "Network buffer logging"
|
||||
select SYS_LOG
|
||||
select LOG
|
||||
help
|
||||
Enable logs and checks for the generic network buffers.
|
||||
|
||||
if NET_BUF_LOG
|
||||
config SYS_LOG_NET_BUF_LEVEL
|
||||
int "Network buffer Logging level"
|
||||
depends on SYS_LOG
|
||||
default 1
|
||||
range 0 4
|
||||
help
|
||||
Sets log level for network buffers.
|
||||
Levels are:
|
||||
0 OFF, do not write
|
||||
1 ERROR, only write SYS_LOG_ERR
|
||||
2 WARNING, write SYS_LOG_WRN in addition to previous level
|
||||
3 INFO, write SYS_LOG_INF in addition to previous levels
|
||||
4 DEBUG, write SYS_LOG_DBG in addition to previous levels
|
||||
|
||||
module=NET_BUF
|
||||
module-dep=LOG
|
||||
module-str=Log level for network buffer handling
|
||||
module-help=Sets log level for network buffers.
|
||||
source "subsys/net/Kconfig.template.log_config.net"
|
||||
|
||||
config NET_BUF_WARN_ALLOC_INTERVAL
|
||||
int "Interval of Network buffer allocation warnings"
|
||||
|
@ -58,7 +51,7 @@ config NET_BUF_WARN_ALLOC_INTERVAL
|
|||
|
||||
config NET_BUF_SIMPLE_LOG
|
||||
bool "Network buffer memory debugging"
|
||||
select SYS_LOG
|
||||
select LOG
|
||||
help
|
||||
Enable extra debug logs and checks for the generic network buffers.
|
||||
|
||||
|
|
|
@ -15,15 +15,17 @@
|
|||
#include <net/buf.h>
|
||||
|
||||
#if defined(CONFIG_NET_BUF_LOG)
|
||||
#define SYS_LOG_DOMAIN "net/buf"
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_NET_BUF_LEVEL
|
||||
#include <logging/sys_log.h>
|
||||
#define LOG_MODULE_NAME net_buf
|
||||
#define NET_LOG_LEVEL CONFIG_NET_BUF_LOG_LEVEL
|
||||
|
||||
#define NET_BUF_DBG(fmt, ...) SYS_LOG_DBG("(%p) " fmt, k_current_get(), \
|
||||
##__VA_ARGS__)
|
||||
#define NET_BUF_ERR(fmt, ...) SYS_LOG_ERR(fmt, ##__VA_ARGS__)
|
||||
#define NET_BUF_WARN(fmt, ...) SYS_LOG_WRN(fmt, ##__VA_ARGS__)
|
||||
#define NET_BUF_INFO(fmt, ...) SYS_LOG_INF(fmt, ##__VA_ARGS__)
|
||||
#include <logging/log.h>
|
||||
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__)
|
||||
#define NET_BUF_WARN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
|
||||
#define NET_BUF_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
|
||||
#define NET_BUF_ASSERT(cond) do { if (!(cond)) { \
|
||||
NET_BUF_ERR("assert: '" #cond "' failed"); \
|
||||
} } while (0)
|
||||
|
|
Loading…
Reference in a new issue