luat_log.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef LUAT_LOG
  2. #define LUAT_LOG
  3. #define LUAT_LOG_DEBUG 1
  4. #define LUAT_LOG_INFO 2
  5. #define LUAT_LOG_WARN 3
  6. #define LUAT_LOG_ERROR 4
  7. #define LUAT_LOG_CLOSE 7
  8. void luat_print(const char* _str);
  9. void luat_nprint(char *s, size_t l);
  10. void luat_log_set_uart_port(int port);
  11. void luat_log_set_level(int level);
  12. int luat_log_get_level(void);
  13. void luat_log_log(int level, const char* tag, const char* _fmt, ...);
  14. // void luat_log_debug(const char* tag, const char* _fmt, ...);
  15. // void luat_log_info(const char* tag, const char* _fmt, ...);
  16. // void luat_log_warn(const char* tag, const char* _fmt, ...);
  17. // void luat_log_error(const char* tag, const char* _fmt, ...);
  18. #define LLOGE(format, ...) printf("E/" LUAT_LOG_TAG " " format "\n", ##__VA_ARGS__)
  19. #define LLOGW(format, ...) printf("W/" LUAT_LOG_TAG " " format "\n", ##__VA_ARGS__)
  20. #define LLOGI(format, ...) printf("I/" LUAT_LOG_TAG " " format "\n", ##__VA_ARGS__)
  21. #define LLOGD(format, ...) printf("D/" LUAT_LOG_TAG " " format "\n", ##__VA_ARGS__)
  22. // #define luat_log_error(XTAG, format, ...) luat_log_log(LUAT_LOG_ERROR, XTAG, format, ##__VA_ARGS__)
  23. // #define luat_log_warn(XTAG, format, ...) luat_log_log(LUAT_LOG_WARN, XTAG, format, ##__VA_ARGS__)
  24. // #define luat_log_info(XTAG, format, ...) luat_log_log(LUAT_LOG_INFO, XTAG, format, ##__VA_ARGS__)
  25. // #define luat_log_debug(XTAG, format, ...) luat_log_log(LUAT_LOG_DEBUG, XTAG, format, ##__VA_ARGS__)
  26. #endif