Standardize log tag

This commit is contained in:
Edward Firmo
2025-08-05 08:54:45 +02:00
parent 6d16d7d645
commit 1d8b4fee1a
6 changed files with 115 additions and 93 deletions

View File

@@ -47,10 +47,12 @@ binary_sensor:
on_state:
then:
- lambda: |-
static const char *TAG = "binary_sensor.bs_pending_restart.core.common";
if (x)
ESP_LOGW("binary_sensor.bs_pending_restart.core.common", "Pending restart: YES");
ESP_LOGW(TAG, "Pending restart: YES");
else
ESP_LOGCONFIG("binary_sensor.bs_pending_restart.core.common", "Pending restart: No");
ESP_LOGD(TAG, "Pending restart: No");
- script.execute: dump_config_caller
button:
@@ -150,10 +152,12 @@ script:
- lambda: return sl_tx_model_format->active_index().has_value();
- lambda: return sl_tx_model_gang->active_index().has_value();
- lambda: |-
static const char *TAG = "script.boot_initialize.core.common";
id(is_us_model) = (sl_tx_model_format->state == "${TX_MODEL_FORMAT_US_TEXT}");
id(gang_count) = sl_tx_model_gang->active_index().value() + 1;
if (id(gang_count) < 1 || id(gang_count) > 4) {
ESP_LOGE("script.boot_initialize.core.common", "Invalid number of gangs: %" PRIu8, id(gang_count));
ESP_LOGE(TAG, "Invalid number of gangs: %" PRIu8, id(gang_count));
}
- id: boot_sequence
@@ -169,38 +173,40 @@ script:
then:
# Extended by all modules
- lambda: |-
static const char *TAG = "script.dump_config.core.common";
// Device identification
ESP_LOGCONFIG("script.dump_config.core.common", "Device friendly name: ${friendly_name}");
ESP_LOGCONFIG("script.dump_config.core.common", "Device name: ${name}");
ESP_LOGCONFIG("script.dump_config.core.common", "Device name (HA): %s", tx_device_name->state.c_str());
ESP_LOGCONFIG("script.dump_config.core.common", "Device hostname: %s", App.get_name().c_str());
ESP_LOGCONFIG(TAG, "Device friendly name: ${friendly_name}");
ESP_LOGCONFIG(TAG, "Device name: ${name}");
ESP_LOGCONFIG(TAG, "Device name (HA): %s", tx_device_name->state.c_str());
ESP_LOGCONFIG(TAG, "Device hostname: %s", App.get_name().c_str());
dump_config_versions->execute();
// Framework detection
#ifdef USE_ARDUINO
ESP_LOGCONFIG("script.dump_config.core.common", "Framework: Arduino");
ESP_LOGCONFIG(TAG, "Framework: Arduino");
#elif defined(USE_ESP_IDF)
ESP_LOGCONFIG("script.dump_config.core.common", "Framework: ESP-IDF");
ESP_LOGCONFIG(TAG, "Framework: ESP-IDF");
#else
ESP_LOGW("script.dump_config.core.common", "Framework: UNKNOWN");
ESP_LOGW(TAG, "Framework: UNKNOWN");
#endif
// Model configuration
ESP_LOGCONFIG("script.dump_config.core.common", "Model format (selected): %s",
ESP_LOGCONFIG(TAG, "Model format (selected): %s",
sl_tx_model_format->state.c_str());
ESP_LOGCONFIG("script.dump_config.core.common", "Model format (detected): %s",
ESP_LOGCONFIG(TAG, "Model format (detected): %s",
id(is_us_model) ? "US" : "EU");
ESP_LOGCONFIG("script.dump_config.core.common", "Gangs (selected): %s",
ESP_LOGCONFIG(TAG, "Gangs (selected): %s",
sl_tx_model_gang->state.c_str());
ESP_LOGCONFIG("script.dump_config.core.common", "Gangs (detected): %" PRIu8 "-Gang%s",
ESP_LOGCONFIG(TAG, "Gangs (detected): %" PRIu8 "-Gang%s",
id(gang_count), id(gang_count) > 1 ? "s" : "");
// System state
if (bs_pending_restart->state)
ESP_LOGW("script.dump_config.core.common", "Pending restart: YES");
ESP_LOGW(TAG, "Pending restart: YES");
else
ESP_LOGCONFIG("script.dump_config.core.common", "Pending restart: No");
ESP_LOGCONFIG(TAG, "Pending restart: No");
- id: dump_config_caller
mode: restart
@@ -268,7 +274,6 @@ select:
state: true
- lambda: |-
id(is_us_model) = (x == "${TX_MODEL_FORMAT_US_TEXT}");
ESP_LOGI("select.sl_tx_model_gang.core.common", "New model selected: %s", id(is_us_model) ? "US" : "EU");
- id: sl_tx_model_gang
name: Model (Gang)
@@ -292,8 +297,6 @@ select:
state: true
- lambda: |-
id(gang_count) = static_cast<uint8_t>(i) + 1;
ESP_LOGI("select.sl_tx_model_gang.core.common", "New model selected: %" PRIu8 "-%s",
id(gang_count), id(gang_count) > 1 ? "Gangs" : "Gang");
tx_ultimate->set_gang_count(id(gang_count));
text_sensor: