An ESP32-based Redis-watcher and info-displayer https://rpjios.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
532 B

  1. #ifndef __ZW_LOGGING__H__
  2. #define __ZW_LOGGING__H__
  3. #include "zw_common.h"
  4. extern ZWAppConfig gConfig;
  5. extern void (*gPublishLogsEmit)(const char* fmt, ...);
  6. #define dprint(fmt, ...) do { \
  7. if (gConfig.debug) { \
  8. Serial.printf("[%s:%d] " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
  9. } } while (0)
  10. #define zlog(fmt, ...) do { \
  11. if (gConfig.publishLogs && gPublishLogsEmit) { \
  12. gPublishLogsEmit(fmt, ##__VA_ARGS__); \
  13. } else { \
  14. Serial.printf(fmt, ##__VA_ARGS__); \
  15. } } while (0)
  16. #endif