ESP32 / ESP8266 & BME280 / SHT2x sensor with InfluxDB support
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.

DebugLog.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * DebugLog.h
  3. *
  4. * ESP8266 / ESP32 Environmental Sensor
  5. *
  6. * ----------------------------------------------------------------------------
  7. * "THE BEER-WARE LICENSE" (Revision 42):
  8. * <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  9. * you can do whatever you want with this stuff. If we meet some day, and you
  10. * think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  11. * ----------------------------------------------------------------------------
  12. */
  13. #ifndef _DEBUG_LOG_H_
  14. #define _DEBUG_LOG_H_
  15. #include <Arduino.h>
  16. #ifdef ENABLE_DEBUGLOG
  17. #include <CircularBuffer.h>
  18. #define DEBUG_LOG_HISTORY_SIZE 1024
  19. #endif // ENABLE_DEBUGLOG
  20. class DebugLog {
  21. public:
  22. #ifdef ENABLE_DEBUGLOG
  23. String getBuffer(void);
  24. #endif // ENABLE_DEBUGLOG
  25. void write(char c);
  26. void print(String s);
  27. void print(int n);
  28. void println(void);
  29. void println(String s);
  30. void println(int n);
  31. private:
  32. void sendToTargets(String s);
  33. #ifdef ENABLE_DEBUGLOG
  34. void addToBuffer(String s);
  35. CircularBuffer<char, DEBUG_LOG_HISTORY_SIZE> buffer;
  36. #endif // ENABLE_DEBUGLOG
  37. };
  38. extern DebugLog debug;
  39. #endif // _DEBUG_LOG_H_