1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-28 16:12:24 +01:00
This commit is contained in:
J. Nick Koston
2025-09-05 22:01:10 -05:00
parent 1108dd8e78
commit 52fe034bff
2 changed files with 7 additions and 5 deletions

View File

@@ -16,7 +16,6 @@
namespace esphome { namespace esphome {
static const char *const TAG = "component"; static const char *const TAG = "component";
static const auto *const UNSPECIFIED_MESSAGE = LOG_STR("unspecified");
// Global vectors for component data that doesn't belong in every instance. // Global vectors for component data that doesn't belong in every instance.
// Using vector instead of unordered_map for both because: // Using vector instead of unordered_map for both because:
@@ -143,7 +142,7 @@ void Component::call_dump_config() {
} }
} }
ESP_LOGE(TAG, " %s is marked FAILED: %s", this->get_component_source(), ESP_LOGE(TAG, " %s is marked FAILED: %s", this->get_component_source(),
error_msg ? error_msg : LOG_STR_ARG(UNSPECIFIED_MESSAGE)); error_msg ? error_msg : LOG_STR_LITERAL("unspecified"));
} }
} }
@@ -293,14 +292,14 @@ void Component::status_set_warning(const char *message) {
this->status_set_warning_flag_(); this->status_set_warning_flag_();
if ((this->component_state_ & STATUS_LED_WARNING) != 0) if ((this->component_state_ & STATUS_LED_WARNING) != 0)
ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(), ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(),
message ? message : LOG_STR_ARG(UNSPECIFIED_MESSAGE)); message ? message : LOG_STR_LITERAL("unspecified"));
} }
#ifdef USE_STORE_LOG_STR_IN_FLASH #ifdef USE_STORE_LOG_STR_IN_FLASH
void Component::status_set_warning(const LogString *message) { void Component::status_set_warning(const LogString *message) {
this->status_set_warning_flag_(); this->status_set_warning_flag_();
if ((this->component_state_ & STATUS_LED_WARNING) != 0) if ((this->component_state_ & STATUS_LED_WARNING) != 0)
ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(), ESP_LOGW(TAG, "%s set Warning flag: %s", this->get_component_source(),
message ? LOG_STR_ARG(message) : LOG_STR_ARG(UNSPECIFIED_MESSAGE)); message ? LOG_STR_ARG(message) : LOG_STR_LITERAL("unspecified"));
} }
#endif #endif
void Component::status_set_error(const char *message) { void Component::status_set_error(const char *message) {
@@ -309,7 +308,7 @@ void Component::status_set_error(const char *message) {
this->component_state_ |= STATUS_LED_ERROR; this->component_state_ |= STATUS_LED_ERROR;
App.app_state_ |= STATUS_LED_ERROR; App.app_state_ |= STATUS_LED_ERROR;
ESP_LOGE(TAG, "%s set Error flag: %s", this->get_component_source(), ESP_LOGE(TAG, "%s set Error flag: %s", this->get_component_source(),
message ? message : LOG_STR_ARG(UNSPECIFIED_MESSAGE)); message ? message : LOG_STR_LITERAL("unspecified"));
if (message != nullptr) { if (message != nullptr) {
// Lazy allocate the error messages vector if needed // Lazy allocate the error messages vector if needed
if (!component_error_messages) { if (!component_error_messages) {

View File

@@ -9,6 +9,9 @@
namespace esphome { namespace esphome {
// Forward declaration for LogString
struct LogString;
/** Default setup priorities for components of different types. /** Default setup priorities for components of different types.
* *
* Components should return one of these setup priorities in get_setup_priority. * Components should return one of these setup priorities in get_setup_priority.