logger.h 1005 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #ifdef SWAGLOG
  3. // cppcheck-suppress preprocessorErrorDirective
  4. #include SWAGLOG
  5. #else
  6. #define CLOUDLOG_DEBUG 10
  7. #define CLOUDLOG_INFO 20
  8. #define CLOUDLOG_WARNING 30
  9. #define CLOUDLOG_ERROR 40
  10. #define CLOUDLOG_CRITICAL 50
  11. #define cloudlog(lvl, fmt, ...) printf(fmt "\n", ## __VA_ARGS__)
  12. #define cloudlog_rl(burst, millis, lvl, fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
  13. #define LOGD(fmt, ...) cloudlog(CLOUDLOG_DEBUG, fmt, ## __VA_ARGS__)
  14. #define LOG(fmt, ...) cloudlog(CLOUDLOG_INFO, fmt, ## __VA_ARGS__)
  15. #define LOGW(fmt, ...) cloudlog(CLOUDLOG_WARNING, fmt, ## __VA_ARGS__)
  16. #define LOGE(fmt, ...) cloudlog(CLOUDLOG_ERROR, fmt, ## __VA_ARGS__)
  17. #define LOGD_100(fmt, ...) cloudlog_rl(2, 100, CLOUDLOG_DEBUG, fmt, ## __VA_ARGS__)
  18. #define LOG_100(fmt, ...) cloudlog_rl(2, 100, CLOUDLOG_INFO, fmt, ## __VA_ARGS__)
  19. #define LOGW_100(fmt, ...) cloudlog_rl(2, 100, CLOUDLOG_WARNING, fmt, ## __VA_ARGS__)
  20. #define LOGE_100(fmt, ...) cloudlog_rl(2, 100, CLOUDLOG_ERROR, fmt, ## __VA_ARGS__)
  21. #endif