#include "Logger.h" #include "AllocAbstraction.h" constexpr size_t LOG_SIZE = 1024 * 1024 * 2; static Logger *theLogger = nullptr; Logger *Logger::getInstance() { return theLogger; } void Logger::init() { theLogger = new Logger(); #ifdef PLATFORM_ESP32 Serial.begin(115200); while (!Serial) { } #endif } Logger::Logger() { data_ = (char *)heap_caps_malloc(LOG_SIZE, MALLOC_CAP_SPIRAM); totalSize_ = LOG_SIZE; currentSize_ = 0; } Logger::~Logger() { free(data_); }