Files
ETH_TCP_Demo/osal/include/osal_log.h
2026-02-09 10:27:21 +08:00

45 lines
948 B
C

#ifndef __OSAL_LOG_H__
#define __OSAL_LOG_H__
#include "osal_def.h"
#include "osal_config.h"
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Log API */
void osal_kprintf(const char *fmt, ...);
/* Log Macros */
#if (OSAL_LOG_LEVEL >= OSAL_LOG_LEVEL_ERROR)
#define osal_log_e(fmt, ...) osal_kprintf("[Error] " fmt "\n", ##__VA_ARGS__)
#else
#define osal_log_e(fmt, ...)
#endif
#if (OSAL_LOG_LEVEL >= OSAL_LOG_LEVEL_WARN)
#define osal_log_w(fmt, ...) osal_kprintf("[Warning] " fmt "\n", ##__VA_ARGS__)
#else
#define osal_log_w(fmt, ...)
#endif
#if (OSAL_LOG_LEVEL >= OSAL_LOG_LEVEL_INFO)
#define osal_log_i(fmt, ...) osal_kprintf("[Info] " fmt "\n", ##__VA_ARGS__)
#else
#define osal_log_i(fmt, ...)
#endif
#if (OSAL_LOG_LEVEL >= OSAL_LOG_LEVEL_DEBUG)
#define osal_log_d(fmt, ...) osal_kprintf("[Debug] " fmt "\n", ##__VA_ARGS__)
#else
#define osal_log_d(fmt, ...)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __OSAL_LOG_H__ */