1 /** @file wmlog.h
2  *
3  *  @brief This file contains macros to print logs
4  *
5  *  Copyright 2008-2024 NXP
6  *
7  *  SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 #ifndef __WMLOG_H__
12 #define __WMLOG_H__
13 
14 #include <osa.h>
15 #include "nxp_wifi.h"
16 #include <zephyr/kernel.h>
17 #include <zephyr/logging/log.h>
18 
19 #ifndef PRINTF
20 #define PRINTF printk
21 #endif
22 
23 #if CONFIG_ENABLE_ERROR_LOGS
24 #define wmlog_e(_mod_name_, _fmt_, ...) (void)PRINTF("[%s]%s" _fmt_ "\n\r", _mod_name_, " Error: ", ##__VA_ARGS__)
25 #else
26 #define wmlog_e(...)
27 #endif /* CONFIG_ENABLE_ERROR_LOGS */
28 
29 #if CONFIG_ENABLE_WARNING_LOGS
30 #define wmlog_w(_mod_name_, _fmt_, ...) (void)PRINTF("[%s]%s" _fmt_ "\n\r", _mod_name_, " Warn: ", ##__VA_ARGS__)
31 #else
32 #define wmlog_w(...)
33 #endif /* CONFIG_ENABLE_WARNING_LOGS */
34 
35 /* General debug function. User can map his own debug functions to this
36 ne */
37 #define wmlog(_mod_name_, _fmt_, ...) (void)PRINTF("[%s] " _fmt_ "\n\r", _mod_name_, ##__VA_ARGS__)
38 
39 /* Function entry */
40 #define wmlog_entry(_fmt_, ...) (void)PRINTF("> %s (" _fmt_ ")\n\r", __func__, ##__VA_ARGS__)
41 
42 /* function exit */
43 #define wmlog_exit(_fmt_, ...) (void)PRINTF("< %s" _fmt_ "\n\r", __func__, ##__VA_ARGS__)
44 
45 #endif /* __WMLOG_H__ */
46