log.h 575 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef INC_LOG_H_
  2. #define INC_LOG_H_
  3. #include <stdarg.h>
  4. #define DEBUG_ON 1
  5. #define _LOG_DEBUG
  6. #define _LOG_WARN
  7. #define _LOG_INFO
  8. #define LOG_LEN_MAX 256
  9. typedef enum LOG_LEVEL_U
  10. {
  11. LOG_NONE = 0,
  12. LOG_INFO,
  13. LOG_DEBUG,
  14. LOG_WARN,
  15. LOG_ERROR,
  16. LOG_MAX,
  17. }logLevel_t;
  18. void LogPrint(logLevel_t logLevel,const char *file, const char *func, const int line, char * fmt, ...);
  19. void log_init(void);
  20. int get_udp_sem(void);
  21. #define LOG_PRINT(logLevel, fmt, ...) if(DEBUG_ON){LogPrint(logLevel,__FILE__,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__);}
  22. #endif /* INC_LOG_H_ */