fota_debug.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (C) 2018-2021 Alibaba Group Holding Limited
  3. */
  4. #ifndef _FOTA_DEBUG_H_
  5. #define _FOTA_DEBUG_H_
  6. #include <stdio.h>
  7. #include <errno.h>
  8. #include <syslog.h>
  9. /*
  10. * priority, defined in syslog.h
  11. *
  12. * #define LOG_EMERG 0 // system is unusable
  13. * #define LOG_ALERT 1 // action must be taken immediately
  14. * #define LOG_CRIT 2 // critical conditions
  15. * #define LOG_ERR 3 // error conditions
  16. * #define LOG_WARNING 4 // warning conditions
  17. * #define LOG_NOTICE 5 // normal but significant condition
  18. * #define LOG_INFO 6 // informational
  19. * #define LOG_DEBUG 7 // debug-level messages
  20. */
  21. void fota_log(int priority, const char *format, ...);
  22. #define fota_check(X, errno) \
  23. do { \
  24. if (!(X)) { \
  25. printf("func: %s, errno: %d\n", __func__, errno); \
  26. while(1); \
  27. } \
  28. } while (0)
  29. #define fota_check_param(X) fota_check(X, EINVAL)
  30. #endif /* _FOTA_DEBUG_H_ */