From 78c11e4cbc29bce4749c81cef9c94f6f0c253399 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 19 Mar 2026 10:32:17 -1000 Subject: [PATCH] [core] Rename LOGGER_INIT to EARLY_INIT Better reflects the purpose: pre-Application init phase where only logging setup belongs currently. --- esphome/components/logger/__init__.py | 2 +- esphome/coroutine.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/esphome/components/logger/__init__.py b/esphome/components/logger/__init__.py index 88be43cb17..f5fc284294 100644 --- a/esphome/components/logger/__init__.py +++ b/esphome/components/logger/__init__.py @@ -324,7 +324,7 @@ CONFIG_SCHEMA = cv.All( ) -@coroutine_with_priority(CoroPriority.LOGGER_INIT) +@coroutine_with_priority(CoroPriority.EARLY_INIT) async def to_code(config: ConfigType) -> None: baud_rate: int = config[CONF_BAUD_RATE] level = config[CONF_LEVEL] diff --git a/esphome/coroutine.py b/esphome/coroutine.py index e6632d0c01..3ce94cc979 100644 --- a/esphome/coroutine.py +++ b/esphome/coroutine.py @@ -63,11 +63,11 @@ class CoroPriority(enum.IntEnum): resolution during code generation. """ - # Logger early init - must run before all other code because: - # 1. All code assumes global_logger is ready for ESP_LOG* calls - # 2. Without this, any log call before logger init dereferences nullptr + # Early init - runs before platform init and before Application exists. + # Currently used only to connect logging so ESP_LOG* calls work + # immediately in all subsequent phases. # Examples: logger (1100) - LOGGER_INIT = 1100 + EARLY_INIT = 1100 # Platform initialization # Examples: esp32, esp8266, rp2040