log.h 480 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * log.h
  3. *
  4. * Created on: Nov 7, 2022
  5. * Author: tangm
  6. */
  7. #ifndef INC_LOG_H_
  8. #define INC_LOG_H_
  9. #include <stdarg.h>
  10. #define LOG_LEN_MAX 256
  11. typedef enum LOG_LEVEL_U
  12. {
  13. LOG_NONE = 0,
  14. LOG_INFO,
  15. LOG_DEBUG,
  16. LOG_WARN,
  17. LOG_ERROR,
  18. LOG_MAX,
  19. }logLevel_t;
  20. void LogPrint(logLevel_t logLevel, const char *func, const int line, char * fmt, ...);
  21. #define LOG_PRINT(logLevel, fmt, ...) LogPrint(logLevel, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
  22. #endif /* INC_LOG_H_ */