zephyr/samples/net/syslog_net/src/main.c
Jukka Rissanen cd4eb946c4 samples: net: Convert to use generic logging macros
Use generic logging macros LOG_*() instead of NET_*() as the
latter are mostly meant for internal networking stack use.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00

38 lines
664 B
C

/*
* Copyright (c) 2018 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <logging/log.h>
LOG_MODULE_REGISTER(net_syslog, LOG_LEVEL_DBG);
#include <zephyr.h>
#include <net/net_core.h>
#include <net/net_pkt.h>
#define SLEEP_BETWEEN_PRINTS K_SECONDS(3)
void main(void)
{
int count = K_SECONDS(60) / SLEEP_BETWEEN_PRINTS;
/* Allow some setup time before starting to send data */
k_sleep(SLEEP_BETWEEN_PRINTS);
LOG_DBG("Starting");
do {
LOG_ERR("Error message");
LOG_WRN("Warning message");
LOG_INF("Info message");
LOG_DBG("Debug message");
k_sleep(SLEEP_BETWEEN_PRINTS);
} while (count--);
LOG_DBG("Stopping");
}