[Cleanup] Set development/debug log as LOG_LEVEL_DEBUG

This commit is contained in:
TD-er
2026-07-16 16:01:57 +02:00
parent f51c3ffb18
commit 61bad0d9a4
5 changed files with 128 additions and 65 deletions
@@ -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
return ESPEasy::net::eth::NW004_data_struct_ETH_SPI::getLabelString;
# endif // ifdef USES_NW004
# ifdef USES_NW005
case 5:
@@ -72,12 +74,12 @@ 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
return ESPEasy::net::eth::NW003_data_struct_ETH_RMII::getNextKey;
# endif // ifdef USES_NW003
# ifdef USES_NW004
case 4:
return ESPEasy::net::eth::NW004_data_struct_ETH_SPI::getNextKey;
# endif
return ESPEasy::net::eth::NW004_data_struct_ETH_SPI::getNextKey;
# 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);
@@ -42,7 +42,7 @@ String getNetworkParameterName(networkDriverIndex_t NetworkDriverIndex
EventStruct tmpEvent;
tmpEvent.idx = parameterIdx;
// Only Network Driver specific call, so may call do_NWPluginCall directly
// Only Network Driver specific call, so may call do_NWPluginCall directly
if (do_NWPluginCall(NetworkDriverIndex, NWPlugin::Function::NWPLUGIN_GET_PARAMETER_DISPLAY_NAME, &tmpEvent, name)) {
// Found an alternative name for it.
isAlternative = true;
@@ -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,
concat(F("Save NW_Enabled: "),
internalName) + ' ' + isFormItemChecked(internalName) + ' ' + Settings.getNetworkEnabled(networkindex));
#endif
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
addLog(LOG_LEVEL_DEBUG,
concat(F("Save NW_Enabled: "),
internalName) + ' ' + isFormItemChecked(internalName) + ' ' + Settings.getNetworkEnabled(networkindex));
}
#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;
+64 -40
View File
@@ -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(
F("KVS: LoadFromFile readSize %d readPos %d"),
readSize,
readPos));
# 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(
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()));
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,17 +1245,21 @@ void ESPEasy_key_value_store::dump() const
val = '-';
}
addLog(LOG_LEVEL_INFO, 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),
it->second.getBinary()[0],
it->second.getBinary()[1],
it->second.getBinary()[2],
it->second.getBinary()[3],
val.c_str()
));
# 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),
it->second.getBinary()[0],
it->second.getBinary()[1],
it->second.getBinary()[2],
it->second.getBinary()[3],
val.c_str()
));
}
# endif // ifndef BUILD_NO_DEBUG
}
for (auto it = _8byte_data.begin(); it != _8byte_data.end(); ++it)
@@ -1253,21 +1273,25 @@ void ESPEasy_key_value_store::dump() const
val = '-';
}
addLog(LOG_LEVEL_INFO, 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),
it->second.getBinary()[0],
it->second.getBinary()[1],
it->second.getBinary()[2],
it->second.getBinary()[3],
it->second.getBinary()[4],
it->second.getBinary()[5],
it->second.getBinary()[6],
it->second.getBinary()[7],
val.c_str()
));
# 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),
it->second.getBinary()[0],
it->second.getBinary()[1],
it->second.getBinary()[2],
it->second.getBinary()[3],
it->second.getBinary()[4],
it->second.getBinary()[5],
it->second.getBinary()[6],
it->second.getBinary()[7],
val.c_str()
));
}
# endif // ifndef BUILD_NO_DEBUG
}
}