1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Update automation logger to include object_id like scripts (#37948)

This commit is contained in:
Phil Bruckner
2020-07-22 10:55:49 -05:00
committed by GitHub
parent aa1c5fc43d
commit 65d1dfba62
3 changed files with 61 additions and 18 deletions

View File

@@ -1255,3 +1255,22 @@ async def test_shutdown_after(hass, caplog):
"Stopping scripts running too long after shutdown: test script"
in caplog.text
)
async def test_update_logger(hass, caplog):
"""Test updating logger."""
sequence = cv.SCRIPT_SCHEMA({"event": "test_event"})
script_obj = script.Script(hass, sequence)
await script_obj.async_run()
await hass.async_block_till_done()
assert script.__name__ in caplog.text
log_name = "testing.123"
script_obj.update_logger(logging.getLogger(log_name))
await script_obj.async_run()
await hass.async_block_till_done()
assert log_name in caplog.text