| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- #ifndef __SYS_LOG_H__
- #define __SYS_LOG_H__
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdio.h>
- #include <stdarg.h>
- #include <stdint.h>
- #define FW_DEBUG_LEVEL 5
- #define FW_INFO_LEVEL 4
- #define FW_WARN_LEVEL 3
- #define FW_ERROR_LEVEL 2
- #define FW_FATAL_LEVEL 1
- typedef void (*log_print_callback_fp) (uint8_t* data, uint8_t len);
- void Sys_LogPrintCallbackRegister(log_print_callback_fp fp);
- void _FW_LogDebug(const char* fmt, ...);
- void _FW_LogInfo(const char* fmt, ...);
- void _FW_LogWarn(const char* fmt, ...);
- void _FW_LogError(const char* fmt, ...);
- void _FW_LogFatal(const char* fmt, ...);
- int FW_GetFileLine(const int8_t* __file__, const int __line__);
- #define DLOG_F(...) if(FW_GetFileLine(__FILE__, __LINE__)) _FW_LogFatal(__VA_ARGS__)
- #define DLOG_E(...) if(FW_GetFileLine(__FILE__, __LINE__)) _FW_LogError(__VA_ARGS__)
- #define DLOG_W(...) if(FW_GetFileLine(__FILE__, __LINE__)) _FW_LogWarn(__VA_ARGS__)
- #define DLOG_I(...) if(FW_GetFileLine(__FILE__, __LINE__)) _FW_LogInfo( __VA_ARGS__)
- #define DLOG_D(...) if(FW_GetFileLine(__FILE__, __LINE__)) _FW_LogDebug(__VA_ARGS__)
- #ifdef __cplusplus
- }
- #endif
- #endif //__SYS_LOG_H__
|