More fixes for logging

This commit is contained in:
Martin Bauer 2023-09-08 13:25:57 +02:00
parent 21ce6d5870
commit 4900c36e0b
2 changed files with 4 additions and 3 deletions

View File

@ -40,7 +40,7 @@ class LoggingAPI
const auto endIt = logger->end();
StaticJsonDocument<512> data;
for(auto it = beginIt; it != endIt; ++beginIt) {
for(auto it = beginIt; it != endIt; ++it) {
data["time"] = it.time_millis();
data["msg"] = it.message();
server.template sendToAll<512>(MessageCode::LOG_UPDATE, data);
@ -51,7 +51,7 @@ class LoggingAPI
private:
bool running_ = false;
Logger::iterator lastEnd_;
Logger::iterator lastEnd_ = Logger::iterator(nullptr);
bool firstCall_ = false;
};

View File

@ -25,6 +25,7 @@
#include "WebsocketServer.h"
#include "SessionAPI.h"
#include "WifiAPI.h"
#include "LoggingAPI.h"
using Session_T = SimpleMeasurementSession<MeasurementT, CONFIG_SESSION_MAX_SIZE>;
SessionManager<Session_T> sessionManager;
@ -35,7 +36,7 @@ EspHttp espHttpServer;
WifiManager wifiManager;
auto apiTuple = std::make_tuple(SessionAPI<Session_T>(sessionManager), WifiAPI(wifiManager));
auto apiTuple = std::make_tuple(SessionAPI<Session_T>(sessionManager), WifiAPI(wifiManager), LoggingAPI());
WebsocketServer<decltype(apiTuple)> websocketServer(81, apiTuple);
//WebsocketServer<Session_T> webSocketServer(sessionManager, userStorage, 81);