replace logString with logDebug

This commit is contained in:
wellenvogel 2021-12-18 18:47:57 +01:00
parent 1bc61f729b
commit 34540405d0
5 changed files with 17 additions and 17 deletions

View File

@ -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;i<getNumConfig();i++){
changedValues[configs[i]->getName()]=configs[i]->getDefault();
}

View File

@ -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(){

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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();
}