ESP32: Conditionally log on services to avoid OOM crashes (#1098)

Also removed new line formatting tidy as it requires a bit of memory which might not be available.


* Use suitably scoped char for log newline stripping

* fix formatting

* Better fix for OOM logging crash

* Limit to ESP32 only

* format changes
This commit is contained in:
buxtronix
2020-06-27 08:13:23 +10:00
committed by GitHub
parent 82d5d50d61
commit 148f5d9418
2 changed files with 10 additions and 10 deletions
-10
View File
@@ -53,16 +53,6 @@ int HOT esp_idf_log_vprintf_(const char *format, va_list args) { // NOLINT
if (log == nullptr)
return 0;
size_t len = strlen(format);
if (format[len - 1] == '\n') {
// Remove trailing newline from format
// Use locally stored
static std::string FORMAT_COPY;
FORMAT_COPY.clear();
FORMAT_COPY.insert(0, format, len - 1);
format = FORMAT_COPY.c_str();
}
log->log_vprintf_(ESPHOME_LOG_LEVEL, "esp-idf", 0, format, args);
#endif
return 0;