Fixing issues in new logging
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
constexpr size_t LOG_SIZE = 1024 * 1024 * 2;
|
||||
|
||||
static Logger *theLogger = nullptr;
|
||||
static Logger * theLogger = nullptr;
|
||||
|
||||
Logger *Logger::getInstance()
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <utility>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define LOG_INFO(...) \
|
||||
@@ -48,14 +49,17 @@ public:
|
||||
currentSize_ += sizeof(time);
|
||||
|
||||
const auto spaceLeft = totalSize_ - currentSize_;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||
auto charsWritten = snprintf(&data_[currentSize_], spaceLeft, formatStr,
|
||||
std::forward<Args>(args)...);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
|
||||
//Serial.println(&data_[currentSize_]);
|
||||
|
||||
if (charsWritten < spaceLeft)
|
||||
if(charsWritten > 0)
|
||||
{
|
||||
currentSize_ += charsWritten;
|
||||
currentSize_ += charsWritten + 1; // + 1 for trailing zero
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -89,6 +93,9 @@ public:
|
||||
current_position_ += sizeof(TimeT) + strlen(message()) + 1;
|
||||
}
|
||||
|
||||
bool operator==(const iterator & o) const { return current_position_ == o.current_position_; }
|
||||
bool operator!=(const iterator & o) const { return current_position_ != o.current_position_; }
|
||||
|
||||
private:
|
||||
const char * current_position_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user