minor cleanup of log messages

This commit is contained in:
proddy
2020-11-28 21:43:33 +01:00
parent cd8cc9d861
commit 558f61489d
6 changed files with 12 additions and 20 deletions

View File

@@ -93,23 +93,22 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
std::string debug(200, '\0');
snprintf_P(&debug[0],
debug.capacity() + 1,
PSTR("API: device=%s cmd=%s data=%s id=%s [%s]"),
PSTR("[DEBUG] API: device=%s cmd=%s data=%s id=%s [%s]"),
device.c_str(),
cmd.c_str(),
data.c_str(),
id.c_str(),
ok ? PSTR("OK") : PSTR("Invalid"));
EMSESP::logger().info(debug.c_str());
EMSESP::logger().debug(debug.c_str());
if (json.size()) {
char buffer2[EMSESP_MAX_JSON_SIZE_DYN];
serializeJson(doc, buffer2);
EMSESP::logger().info("json (max 255 chars): %s", buffer2);
EMSESP::logger().debug("json (max 255 chars): %s", buffer2);
}
#endif
// if we have returned data in JSON format, send this to the WEB
if (json.size()) {
// doc.shrinkToFit();
char buffer[EMSESP_MAX_JSON_SIZE_DYN];
serializeJsonPretty(doc, buffer);
request->send(200, "text/plain", buffer);

View File

@@ -138,32 +138,26 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
// either via the Web UI or via the Console
void WebSettingsService::onUpdate() {
if (WebSettings::has_flags(WebSettings::ChangeFlags::SHOWER)) {
// EMSESP::logger().info(F("shower changed!"));
EMSESP::shower_.start();
}
if (WebSettings::has_flags(WebSettings::ChangeFlags::DALLAS)) {
// EMSESP::logger().info(F("dallas changed!"));
EMSESP::dallassensor_.start();
}
if (WebSettings::has_flags(WebSettings::ChangeFlags::UART)) {
// EMSESP::logger().info(F("uart changed!"));
EMSESP::init_tx();
}
if (WebSettings::has_flags(WebSettings::ChangeFlags::SYSLOG)) {
// EMSESP::logger().info(F("syslog changed!"));
System::syslog_init();
}
if (WebSettings::has_flags(WebSettings::ChangeFlags::OTHER)) {
// EMSESP::logger().info(F("other changed!"));
System::other_init();
}
if (WebSettings::has_flags(WebSettings::ChangeFlags::LED)) {
// EMSESP::logger().info(F("led changed!"));
System::led_init();
}
}

View File

@@ -40,18 +40,18 @@ WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * se
#ifdef ESP32
void WebStatusService::onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info) {
EMSESP::logger().debug(F("WiFi Disconnected. Reason code=%d"), info.disconnected.reason);
EMSESP::logger().info(F("WiFi Disconnected. Reason code=%d"), info.disconnected.reason);
}
void WebStatusService::onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info) {
EMSESP::logger().debug(F("WiFi Connected with IP=%s, hostname=%s"), WiFi.localIP().toString().c_str(), WiFi.getHostname());
EMSESP::logger().info(F("WiFi Connected with IP=%s, hostname=%s"), WiFi.localIP().toString().c_str(), WiFi.getHostname());
EMSESP::system_.send_heartbeat(); // send out heartbeat MQTT as soon as we have a connection
}
#elif defined(ESP8266)
void WebStatusService::onStationModeDisconnected(const WiFiEventStationModeDisconnected & event) {
EMSESP::logger().debug(F("WiFi Disconnected. Reason code=%d"), event.reason);
EMSESP::logger().info(F("WiFi Disconnected. Reason code=%d"), event.reason);
}
void WebStatusService::onStationModeGotIP(const WiFiEventStationModeGotIP & event) {
EMSESP::logger().debug(F("WiFi Connected with IP=%s, hostname=%s"), event.ip.toString().c_str(), WiFi.hostname().c_str());
EMSESP::logger().info(F("WiFi Connected with IP=%s, hostname=%s"), event.ip.toString().c_str(), WiFi.hostname().c_str());
EMSESP::system_.send_heartbeat(); // send out heartbeat MQTT as soon as we have a connection
}
#endif

View File

@@ -327,7 +327,6 @@ bool EMSdevice::handle_telegram(std::shared_ptr<const Telegram> telegram) {
return false;
}
// EMSESP::logger().debug(F("Received %s"), uuid::read_flash_string(tf.telegram_type_name_).c_str());
tf.process_function_(telegram);
return true;
}

View File

@@ -681,7 +681,7 @@ void Mqtt::process_queue() {
if (mqtt_qos_ != 0) {
mqtt_messages_.front().packet_id_ = packet_id;
#if defined(EMSESP_DEBUG)
LOG_DEBUG(F("Setting packetID for ACK to %d"), packet_id);
LOG_DEBUG(F("[DEBUG] Setting packetID for ACK to %d"), packet_id);
#endif
return;
}
@@ -821,9 +821,9 @@ void Mqtt::register_mqtt_ha_sensor(const char * prefix,
LOG_ERROR(F("Failed to publish topic %s"), topic);
} else {
#if defined(EMSESP_STANDALONE)
LOG_DEBUG(F("Publishing topic=%s, payload=%s"), topic, payload_text.c_str());
LOG_DEBUG(F("[DEBUG] Publishing topic=%s, payload=%s"), topic, payload_text.c_str());
#else
LOG_DEBUG(F("Publishing topic %s"), topic);
LOG_DEBUG(F("[DEBUG] Publishing topic %s"), topic);
#endif
}

View File

@@ -93,7 +93,7 @@ bool System::command_publish(const char * value, const int8_t id) {
// restart EMS-ESP
void System::restart() {
LOG_NOTICE(F("Restarting system..."));
LOG_INFO(F("Restarting system..."));
Shell::loop_all();
delay(1000); // wait a second
#if defined(ESP8266)
@@ -105,7 +105,7 @@ void System::restart() {
// saves all settings
void System::wifi_reconnect() {
LOG_NOTICE(F("The wifi will reconnect..."));
LOG_INFO(F("The wifi will reconnect..."));
Shell::loop_all();
delay(1000); // wait a second
EMSESP::webSettingsService.save(); // local settings