mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-23 22:28:28 +02:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user