初始化版本
This commit is contained in:
44
osal/include/osal_log.h
Normal file
44
osal/include/osal_log.h
Normal file
@ -0,0 +1,44 @@
|
||||
#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__ */
|
||||
Reference in New Issue
Block a user