mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-20 04:53:28 +02:00
Filter some debug lines from PlatformIO in output (#771)
* Filter some debug lines from PlatformIO in output * Lint * Strip trailing newline from esp-idf output * Only create global std::string if on esp32
This commit is contained in:
+13
-1
@@ -46,15 +46,27 @@ void HOT esp_log_vprintf_(int level, const char *tag, int line, const __FlashStr
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
int HOT esp_idf_log_vprintf_(const char *format, va_list args) { // NOLINT
|
||||
#ifdef USE_LOGGER
|
||||
auto *log = logger::global_logger;
|
||||
if (log == nullptr)
|
||||
return 0;
|
||||
|
||||
log->log_vprintf_(ESPHOME_LOG_LEVEL, "", 0, format, args);
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace esphome
|
||||
|
||||
Reference in New Issue
Block a user