32 lines
431 B
C++
32 lines
431 B
C++
#include "Logger.h"
|
|
|
|
constexpr size_t LOG_SIZE = 1024 * 1024 * 2;
|
|
|
|
static Logger *theLogger = nullptr;
|
|
|
|
Logger *Logger::getInstance()
|
|
{
|
|
return theLogger;
|
|
}
|
|
|
|
void Logger::init()
|
|
{
|
|
theLogger = new Logger();
|
|
Serial.begin(115200);
|
|
while (!Serial)
|
|
{
|
|
}
|
|
}
|
|
|
|
Logger::Logger()
|
|
{
|
|
data_ = (char *)heap_caps_malloc(LOG_SIZE, MALLOC_CAP_SPIRAM);
|
|
totalSize_ = LOG_SIZE;
|
|
currentSize_ = 0;
|
|
}
|
|
|
|
|
|
Logger::~Logger()
|
|
{
|
|
free(data_);
|
|
} |