This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhuzhenjun-libosfp/src/osfp_log.h

25 lines
845 B
C
Raw Normal View History

2023-09-27 11:45:26 +08:00
#ifndef __OSFP_LOG_H__
#define __OSFP_LOG_H__
2023-09-27 15:43:32 +08:00
enum osfp_log_level {
2023-09-27 11:45:26 +08:00
OSFP_LOG_LEVEL_DEBUG,
OSFP_LOG_LEVEL_INFO,
OSFP_LOG_LEVEL_WARNING,
OSFP_LOG_LEVEL_ERROR
2023-09-27 15:43:32 +08:00
};
2023-09-27 11:45:26 +08:00
2023-09-27 15:43:32 +08:00
#ifndef DEBUGLOG
2023-09-27 11:45:26 +08:00
#define osfp_log_debug(...) do { } while (0)
#else
#define osfp_log_debug(...) osfp_log(OSFP_LOG_LEVEL_DEBUG, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#endif
#define osfp_log_info(...) osfp_log(OSFP_LOG_LEVEL_INFO, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define osfp_log_warning(...) osfp_log(OSFP_LOG_LEVEL_WARNING, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define osfp_log_error(...) osfp_log(OSFP_LOG_LEVEL_ERROR, __FILE__, __LINE__, __FUNCTION__,__VA_ARGS__)
2023-09-27 15:43:32 +08:00
void osfp_log_level_set(enum osfp_log_level level);
2023-09-27 11:45:26 +08:00
void osfp_log(unsigned int x, const char *file, const int line, const char *func, const char *fmt, ...);
#endif