swimtracker-firmware/firmware/lib/logging/Logger.cpp

35 lines
495 B
C++
Raw Normal View History

2021-08-10 22:47:47 +02:00
#include "Logger.h"
2023-08-28 15:06:29 +02:00
#include "AllocAbstraction.h"
2021-08-10 22:47:47 +02:00
constexpr size_t LOG_SIZE = 1024 * 1024 * 2;
2023-09-07 15:27:29 +02:00
static Logger * theLogger = nullptr;
2021-08-10 22:47:47 +02:00
Logger *Logger::getInstance()
{
return theLogger;
}
void Logger::init()
{
theLogger = new Logger();
2023-08-28 15:06:29 +02:00
#ifdef PLATFORM_ESP32
2021-08-10 22:47:47 +02:00
Serial.begin(115200);
while (!Serial)
{
}
2023-08-28 15:06:29 +02:00
#endif
2021-08-10 22:47:47 +02:00
}
Logger::Logger()
{
data_ = (char *)heap_caps_malloc(LOG_SIZE, MALLOC_CAP_SPIRAM);
totalSize_ = LOG_SIZE;
currentSize_ = 0;
}
Logger::~Logger()
{
free(data_);
}