From 34540405d07e2e82a2b7fe742d82fbbf1c7292ea Mon Sep 17 00:00:00 2001 From: wellenvogel Date: Sat, 18 Dec 2021 18:47:57 +0100 Subject: [PATCH] replace logString with logDebug --- lib/config/GWConfig.cpp | 8 ++++---- lib/nmea2kto0183/N2kDataToNMEA0183.cpp | 2 +- lib/socketserver/GwSocketServer.cpp | 8 ++++---- lib/wifi/GwWifi.cpp | 10 +++++----- src/main.cpp | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/config/GWConfig.cpp b/lib/config/GWConfig.cpp index c6b4af8..7aef68b 100644 --- a/lib/config/GWConfig.cpp +++ b/lib/config/GWConfig.cpp @@ -39,7 +39,7 @@ String GwConfigHandler::toJson() const{ } } serializeJson(jdoc,rt); - logger->logString("configJson: %s",rt.c_str()); + LOG_DEBUG(GwLog::DEBUG,"configJson: %s",rt.c_str()); return rt; } @@ -71,11 +71,11 @@ bool GwConfigHandler::saveConfig(){ if (it != changedValues.end()){ val=it->second; } - logger->logString("saving %s=%s",configs[i]->getName().c_str(),val.c_str()); + LOG_DEBUG(GwLog::LOG,"saving %s=%s",configs[i]->getName().c_str(),val.c_str()); prefs.putString(configs[i]->getName().c_str(),val); } prefs.end(); - logger->logString("saved config"); + LOG_DEBUG(GwLog::LOG,"saved config"); return true; } @@ -92,7 +92,7 @@ bool GwConfigHandler::updateValue(String name, String value){ return true; } bool GwConfigHandler::reset(bool save){ - logger->logString("reset config"); + LOG_DEBUG(GwLog::LOG,"reset config"); for (int i=0;igetName()]=configs[i]->getDefault(); } diff --git a/lib/nmea2kto0183/N2kDataToNMEA0183.cpp b/lib/nmea2kto0183/N2kDataToNMEA0183.cpp index 94ea9fb..240823c 100644 --- a/lib/nmea2kto0183/N2kDataToNMEA0183.cpp +++ b/lib/nmea2kto0183/N2kDataToNMEA0183.cpp @@ -142,7 +142,7 @@ private: virtual unsigned long *handledPgns() { - logger->logString("CONV: # %d handled PGNS", converters.numConverters()); + LOG_DEBUG(GwLog::LOG,"CONV: # %d handled PGNS", converters.numConverters()); return converters.handledPgns(); } virtual String handledKeys(){ diff --git a/lib/socketserver/GwSocketServer.cpp b/lib/socketserver/GwSocketServer.cpp index 4dfe897..f9c7f6d 100644 --- a/lib/socketserver/GwSocketServer.cpp +++ b/lib/socketserver/GwSocketServer.cpp @@ -163,7 +163,7 @@ void GwSocketServer::begin(){ } server=new WiFiServer(config->getInt(config->serverPort),maxClients+1); server->begin(); - logger->logString("Socket server created, port=%d", + LOG_DEBUG(GwLog::LOG,"Socket server created, port=%d", config->getInt(config->serverPort)); MDNS.addService("_nmea-0183","_tcp",config->getInt(config->serverPort)); @@ -175,7 +175,7 @@ void GwSocketServer::loop(bool handleRead,bool handleWrite) if (client) { - logger->logString("new client connected from %s", + LOG_DEBUG(GwLog::LOG,"new client connected from %s", client.remoteIP().toString().c_str()); fcntl(client.fd(), F_SETFL, O_NONBLOCK); bool canHandle = false; @@ -184,7 +184,7 @@ void GwSocketServer::loop(bool handleRead,bool handleWrite) if (!clients[i]->hasClient()) { clients[i]->setClient(wiFiClientPtr(new WiFiClient(client))); - logger->logString("set client as number %d", i); + LOG_DEBUG(GwLog::LOG,"set client as number %d", i); canHandle = true; break; } @@ -219,7 +219,7 @@ void GwSocketServer::loop(bool handleRead,bool handleWrite) if (!client->client->connected()) { - logger->logString("client %d disconnect %s", i, client->remoteIp.c_str()); + LOG_DEBUG(GwLog::LOG,"client %d disconnect %s", i, client->remoteIp.c_str()); client->client->stop(); client->setClient(NULL); } diff --git a/lib/wifi/GwWifi.cpp b/lib/wifi/GwWifi.cpp index 2190036..bad7a0c 100644 --- a/lib/wifi/GwWifi.cpp +++ b/lib/wifi/GwWifi.cpp @@ -11,7 +11,7 @@ GwWifi::GwWifi(const GwConfigHandler *config,GwLog *log, bool fixedApPass){ this->fixedApPass=fixedApPass; } void GwWifi::setup(){ - logger->logString("Wifi setup"); + LOG_DEBUG(GwLog::LOG,"Wifi setup"); IPAddress AP_local_ip(192, 168, 15, 1); // Static address for AP IPAddress AP_gateway(192, 168, 15, 1); @@ -26,7 +26,7 @@ void GwWifi::setup(){ } delay(100); WiFi.softAPConfig(AP_local_ip, AP_gateway, AP_subnet); - logger->logString("WifiAP created: ssid=%s,adress=%s", + LOG_DEBUG(GwLog::LOG,"WifiAP created: ssid=%s,adress=%s", ssid, WiFi.softAPIP().toString().c_str() ); @@ -34,7 +34,7 @@ void GwWifi::setup(){ lastApAccess=millis(); apShutdownTime=config->getConfigItem(config->stopApTime)->asInt() * 60; if (apShutdownTime < 120 && apShutdownTime != 0) apShutdownTime=120; //min 2 minutes - logger->logString("GWWIFI: AP auto shutdown %s (%ds)",apShutdownTime> 0?"enabled":"disabled",apShutdownTime); + LOG_DEBUG(GwLog::LOG,"GWWIFI: AP auto shutdown %s (%ds)",apShutdownTime> 0?"enabled":"disabled",apShutdownTime); apShutdownTime=apShutdownTime*1000; //ms clientIsConnected=false; connectInternal(); @@ -42,7 +42,7 @@ void GwWifi::setup(){ bool GwWifi::connectInternal(){ if (wifiClient->asBoolean()){ clientIsConnected=false; - logger->logString("creating wifiClient ssid=%s",wifiSSID->asString().c_str()); + LOG_DEBUG(GwLog::LOG,"creating wifiClient ssid=%s",wifiSSID->asString().c_str()); wl_status_t rt=WiFi.begin(wifiSSID->asCString(),wifiPass->asCString()); LOG_DEBUG(GwLog::LOG,"wifiClient connect returns %d",(int)rt); lastConnectStart=millis(); @@ -76,7 +76,7 @@ void GwWifi::loop(){ lastApAccess=millis(); } if ((lastApAccess + apShutdownTime) < millis()){ - logger->logString("GWWIFI: shutdown AP"); + LOG_DEBUG(GwLog::LOG,"GWWIFI: shutdown AP"); WiFi.softAPdisconnect(true); apActive=false; } diff --git a/src/main.cpp b/src/main.cpp index ca6ba6d..be18d13 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -595,7 +595,7 @@ protected: bool rt = config.updateValue(it->first, it->second); if (!rt) { - logger.logString("ERR: unable to update %s to %s", it->first.c_str(), it->second.c_str()); + logger.logDebug(GwLog::ERROR,"ERR: unable to update %s to %s", it->first.c_str(), it->second.c_str()); ok = false; error += it->first; error += "="; @@ -606,7 +606,7 @@ protected: if (ok) { result = JSON_OK; - logger.logString("update config and restart"); + logger.logDebug(GwLog::ERROR,"update config and restart"); config.saveConfig(); delayedRestart(); } @@ -634,7 +634,7 @@ protected: return; } config.reset(true); - logger.logString("reset config, restart"); + logger.logDebug(GwLog::ERROR,"reset config, restart"); result = JSON_OK; delayedRestart(); }