mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[Cleanup] Set development/debug log as LOG_LEVEL_DEBUG
This commit is contained in:
@@ -355,14 +355,16 @@ bool NWPluginData_base::handle_priority_route_changed()
|
||||
auto tmp = _netif->dnsIP(i);
|
||||
|
||||
if (valid_DNS_address(cache->_dns_cache[i]) && (cache->_dns_cache[i] != tmp)) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG))
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(
|
||||
F("%s: Restore cached DNS server %d from %s to %s"),
|
||||
_netif->desc(),
|
||||
i,
|
||||
tmp.toString().c_str(),
|
||||
cache->_dns_cache[i].toString().c_str()
|
||||
));
|
||||
|
||||
#endif
|
||||
_netif->dnsIP(i, cache->_dns_cache[i]);
|
||||
res = true;
|
||||
}
|
||||
|
||||
@@ -13,11 +13,13 @@
|
||||
|
||||
|
||||
# ifdef USES_NW001
|
||||
//# include "../NWPluginStructs/NW001_data_struct_WiFi_STA.h"
|
||||
# endif
|
||||
|
||||
// # include "../NWPluginStructs/NW001_data_struct_WiFi_STA.h"
|
||||
# endif // ifdef USES_NW001
|
||||
# ifdef USES_NW002
|
||||
//# include "../NWPluginStructs/NW002_data_struct_WiFi_AP.h"
|
||||
# endif
|
||||
|
||||
// # include "../NWPluginStructs/NW002_data_struct_WiFi_AP.h"
|
||||
# endif // ifdef USES_NW002
|
||||
# ifdef USES_NW003
|
||||
# include "../NWPluginStructs/NW003_data_struct_ETH_RMII.h"
|
||||
# endif
|
||||
@@ -39,11 +41,11 @@ ESPEasy_key_value_store_import_export::LabelStringFunction getLabelFnc(ESPEasy::
|
||||
# ifdef USES_NW003
|
||||
case 3:
|
||||
return ESPEasy::net::eth::NW003_data_struct_ETH_RMII::getLabelString;
|
||||
# endif
|
||||
# endif // ifdef USES_NW003
|
||||
# ifdef USES_NW004
|
||||
case 4:
|
||||
return ESPEasy::net::eth::NW004_data_struct_ETH_SPI::getLabelString;
|
||||
# endif
|
||||
# endif // ifdef USES_NW004
|
||||
|
||||
# ifdef USES_NW005
|
||||
case 5:
|
||||
@@ -73,11 +75,11 @@ ESPEasy_key_value_store_import_export::NextKeyFunction getNextKeyFnc(ESPEasy::ne
|
||||
# ifdef USES_NW003
|
||||
case 3:
|
||||
return ESPEasy::net::eth::NW003_data_struct_ETH_RMII::getNextKey;
|
||||
# endif
|
||||
# endif // ifdef USES_NW003
|
||||
# ifdef USES_NW004
|
||||
case 4:
|
||||
return ESPEasy::net::eth::NW004_data_struct_ETH_SPI::getNextKey;
|
||||
# endif
|
||||
# endif // ifdef USES_NW004
|
||||
# ifdef USES_NW005
|
||||
case 5:
|
||||
{
|
||||
@@ -164,7 +166,12 @@ String NWPlugin_import_export::importConfig(
|
||||
|
||||
if (nwpluginID.isValid()) { return F("KVS : Network Index is already in use"); }
|
||||
|
||||
addLog(LOG_LEVEL_INFO, concat(F("KVS : JSON: "), json));
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, concat(F("KVS : JSON: "), json));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
|
||||
ESPEasy_key_value_store kvs;
|
||||
ESPEasy_key_value_store_import_export e(&kvs, json);
|
||||
|
||||
@@ -207,10 +207,13 @@ void saveNetworkParameterForm(NetworkSettingsStruct & NetworkSettings,
|
||||
case NetworkSettingsStruct::NETWORK_ENABLED:
|
||||
Settings.setNetworkEnabled(networkindex, isFormItemChecked(internalName));
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_INFO,
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG,
|
||||
concat(F("Save NW_Enabled: "),
|
||||
internalName) + ' ' + isFormItemChecked(internalName) + ' ' + Settings.getNetworkEnabled(networkindex));
|
||||
#endif
|
||||
}
|
||||
#endif // ifndef BUILD_NO_DEBUG
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,11 +108,12 @@ bool NW002_data_struct_WiFi_AP::init(EventStruct *event)
|
||||
return false;
|
||||
}
|
||||
# ifdef ESP32
|
||||
|
||||
if (NW_PLUGIN_INTERFACE.hasIP()) {
|
||||
stats_and_cache.mark_got_IP();
|
||||
}
|
||||
NW002_update_NAPT();
|
||||
# endif
|
||||
# endif // ifdef ESP32
|
||||
# if FEATURE_MDNS
|
||||
# ifdef ESP8266
|
||||
|
||||
@@ -162,6 +163,7 @@ bool NW002_data_struct_WiFi_AP::getStaticIPAddress(IPAddressType addressType, IP
|
||||
ip = IPAddress(DEFAULT_AP_SUBNET);
|
||||
return true;
|
||||
case IPAddressType::DNS:
|
||||
|
||||
if (Settings.ApCaptivePortal()) {
|
||||
ip = apIP;
|
||||
} else {
|
||||
@@ -276,7 +278,12 @@ void NW002_data_struct_WiFi_AP::onEvent(arduino_event_id_t event,
|
||||
case ARDUINO_EVENT_WIFI_AP_STACONNECTED:
|
||||
stats_and_cache.mark_connected();
|
||||
NW002_update_NAPT();
|
||||
addLog(LOG_LEVEL_INFO, F("AP_STACONNECTED"));
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("AP_STACONNECTED"));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED:
|
||||
|
||||
@@ -284,20 +291,40 @@ void NW002_data_struct_WiFi_AP::onEvent(arduino_event_id_t event,
|
||||
stats_and_cache.mark_disconnected();
|
||||
}
|
||||
NW002_update_NAPT();
|
||||
addLog(LOG_LEVEL_INFO, F("AP_STADISCONNECTED"));
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("AP_STADISCONNECTED"));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED:
|
||||
addLog(LOG_LEVEL_INFO, F("AP_STAIPASSIGNED"));
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("AP_STAIPASSIGNED"));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (!stats_and_cache.hasIP() && NW_PLUGIN_INTERFACE.hasIP()) {
|
||||
stats_and_cache.mark_got_IP();
|
||||
}
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED:
|
||||
addLog(LOG_LEVEL_INFO, F("AP_PROBEREQRECVED"));
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("AP_PROBEREQRECVED"));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_AP_GOT_IP6:
|
||||
addLog(LOG_LEVEL_INFO, F("AP_GOT_IP6"));
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, F("AP_GOT_IP6"));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
break;
|
||||
|
||||
default: break;
|
||||
|
||||
@@ -91,7 +91,7 @@ bool ESPEasy_key_value_store::load(
|
||||
return false;
|
||||
}
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("KVS Load : Total size %d + offset %d, max size %d"), totalSize, offset_in_block, max_size));
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(F("KVS Load : Total size %d + offset %d, max size %d"), totalSize, offset_in_block, max_size));
|
||||
# endif
|
||||
|
||||
size_t bytesLeftPartialString{};
|
||||
@@ -111,10 +111,15 @@ bool ESPEasy_key_value_store::load(
|
||||
reinterpret_cast<uint8_t *>(&buffer),
|
||||
readSize,
|
||||
readPos);
|
||||
addLog(LOG_LEVEL_INFO, strformat(
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(
|
||||
F("KVS: LoadFromFile readSize %d readPos %d"),
|
||||
readSize,
|
||||
readPos));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
uint32_t bufPos = 0;
|
||||
bool loadNextFromFile = false;
|
||||
|
||||
@@ -294,7 +299,7 @@ bool ESPEasy_key_value_store::store(
|
||||
{
|
||||
if (getState() == State::NotChanged) {
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_INFO, F("KVS: Content not changed, no need to save"));
|
||||
addLog(LOG_LEVEL_DEBUG, F("KVS: Content not changed, no need to save"));
|
||||
# endif
|
||||
return true;
|
||||
}
|
||||
@@ -515,8 +520,11 @@ bool ESPEasy_key_value_store::store(
|
||||
// Consider a successful save the same as a fresh load.
|
||||
// The data is now the same as what is stored
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("KVS: Written %d bytes"), writePos));
|
||||
# endif
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(F("KVS: Written %d bytes"), writePos));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
_state = State::NotChanged;
|
||||
dump();
|
||||
return true;
|
||||
@@ -1195,7 +1203,12 @@ void ESPEasy_key_value_store::updateHasStorageType(KVS_StorageType::Enum storage
|
||||
|
||||
void ESPEasy_key_value_store::dump() const
|
||||
{
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("KVS: Payload Storage size : %d"), getPayloadStorageSize()));
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(F("KVS: Payload Storage size : %d"), getPayloadStorageSize()));
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
|
||||
for (auto it = _string_data.begin(); it != _string_data.end(); ++it)
|
||||
{
|
||||
@@ -1208,14 +1221,17 @@ void ESPEasy_key_value_store::dump() const
|
||||
val)) {
|
||||
val = '-';
|
||||
}
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
addLog(LOG_LEVEL_INFO, strformat(
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(
|
||||
F("KVS: type: %d, combined-key: %x, key: %d, value: '%s' '%s'"),
|
||||
KVS_StorageType::get_StorageType_from_combined_key(it->first),
|
||||
it->first, KVS_StorageType::getKey_from_combined_key(it->first),
|
||||
it->second.c_str(),
|
||||
val.c_str()));
|
||||
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
}
|
||||
|
||||
for (auto it = _4byte_data.begin(); it != _4byte_data.end(); ++it)
|
||||
@@ -1229,7 +1245,10 @@ void ESPEasy_key_value_store::dump() const
|
||||
val = '-';
|
||||
}
|
||||
|
||||
addLog(LOG_LEVEL_INFO, strformat(
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(
|
||||
F("KVS: type: %d, comb: %x, key: %d, val: '%x %x %x %x' strval: '%s'"),
|
||||
KVS_StorageType::get_StorageType_from_combined_key(it->first),
|
||||
it->first, KVS_StorageType::getKey_from_combined_key(it->first),
|
||||
@@ -1239,7 +1258,8 @@ void ESPEasy_key_value_store::dump() const
|
||||
it->second.getBinary()[3],
|
||||
val.c_str()
|
||||
));
|
||||
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
}
|
||||
|
||||
for (auto it = _8byte_data.begin(); it != _8byte_data.end(); ++it)
|
||||
@@ -1253,7 +1273,10 @@ void ESPEasy_key_value_store::dump() const
|
||||
val = '-';
|
||||
}
|
||||
|
||||
addLog(LOG_LEVEL_INFO, strformat(
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
|
||||
addLog(LOG_LEVEL_DEBUG, strformat(
|
||||
F("KVS: type: %d, comb: %x, key: %d, val: '%x %x %x %x %x %x %x %x' strval: '%s'"),
|
||||
KVS_StorageType::get_StorageType_from_combined_key(it->first),
|
||||
it->first, KVS_StorageType::getKey_from_combined_key(it->first),
|
||||
@@ -1267,7 +1290,8 @@ void ESPEasy_key_value_store::dump() const
|
||||
it->second.getBinary()[7],
|
||||
val.c_str()
|
||||
));
|
||||
|
||||
}
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user