1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
-
-
- #ifndef _DEBUG_LOG_H_
- #define _DEBUG_LOG_H_
-
- #include <Arduino.h>
-
- #ifdef ENABLE_DEBUGLOG
- #include <CircularBuffer.h>
- #define DEBUG_LOG_HISTORY_SIZE 1024
- #endif
-
- class DebugLog {
- public:
- #ifdef ENABLE_DEBUGLOG
- String getBuffer(void);
- #endif
-
- void write(char c);
- void print(String s);
- void print(int n);
-
- void println(void);
- void println(String s);
- void println(int n);
-
- size_t printf(const char * format, ...) __attribute__ ((format (printf, 2, 3)));
- size_t printf(const char * format, va_list args);
-
- private:
- void sendToTargets(String s);
-
- #ifdef ENABLE_DEBUGLOG
- void addToBuffer(String s);
-
- CircularBuffer<char, DEBUG_LOG_HISTORY_SIZE> buffer;
- #endif
- };
-
- extern DebugLog debug;
-
- #endif
|