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