Enable debug logging early (#5908)

Set logging level early in the bootstrap process so we can use debug
level messages in the early stages of the Supervisor.
This commit is contained in:
Stefan Agner 2025-05-23 12:03:32 +02:00 committed by GitHub
parent 9e6a4d65cd
commit 87232cf1e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,6 +54,14 @@ async def initialize_coresys() -> CoreSys:
"""Initialize supervisor coresys/objects."""
coresys = await CoreSys().load_config()
# Check if ENV is in development mode
if coresys.dev:
_LOGGER.warning("Environment variable 'SUPERVISOR_DEV' is set")
coresys.config.logging = LogLevel.DEBUG
coresys.config.debug = True
else:
coresys.config.modify_log_level()
# Initialize core objects
coresys.docker = await DockerAPI(coresys).post_init()
coresys.resolution = await ResolutionManager(coresys).load_config()
@ -93,15 +101,9 @@ async def initialize_coresys() -> CoreSys:
# bootstrap config
initialize_system(coresys)
# Check if ENV is in development mode
if coresys.dev:
_LOGGER.warning("Environment variable 'SUPERVISOR_DEV' is set")
coresys.config.logging = LogLevel.DEBUG
coresys.config.debug = True
coresys.updater.channel = UpdateChannel.DEV
coresys.security.content_trust = False
else:
coresys.config.modify_log_level()
# Convert datetime
logging.Formatter.converter = lambda *args: coresys.now().timetuple()