mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Migrate & fix logger services to support translations (#96393)
* Migrate logger services to support translations * Fix tests and schema validation * Apply suggestions from code review Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> --------- Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
parent
18cc56ae96
commit
594d240a96
@ -1,26 +1,14 @@
|
|||||||
set_default_level:
|
set_default_level:
|
||||||
name: Set default level
|
|
||||||
description: Set the default log level for integrations.
|
|
||||||
fields:
|
fields:
|
||||||
level:
|
level:
|
||||||
name: Level
|
|
||||||
description: Default severity level for all integrations.
|
|
||||||
selector:
|
selector:
|
||||||
select:
|
select:
|
||||||
options:
|
options:
|
||||||
- label: "Debug"
|
- "debug"
|
||||||
value: "debug"
|
- "info"
|
||||||
- label: "Info"
|
- "warning"
|
||||||
value: "info"
|
- "error"
|
||||||
- label: "Warning"
|
- "fatal"
|
||||||
value: "warning"
|
- "critical"
|
||||||
- label: "Error"
|
translation_key: level
|
||||||
value: "error"
|
|
||||||
- label: "Fatal"
|
|
||||||
value: "fatal"
|
|
||||||
- label: "Critical"
|
|
||||||
value: "critical"
|
|
||||||
|
|
||||||
set_level:
|
set_level:
|
||||||
name: Set level
|
|
||||||
description: Set log level for integrations.
|
|
||||||
|
30
homeassistant/components/logger/strings.json
Normal file
30
homeassistant/components/logger/strings.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"services": {
|
||||||
|
"set_default_level": {
|
||||||
|
"name": "Set default level",
|
||||||
|
"description": "Sets the default log level for integrations.",
|
||||||
|
"fields": {
|
||||||
|
"level": {
|
||||||
|
"name": "Level",
|
||||||
|
"description": "Default severity level for all integrations."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"set_level": {
|
||||||
|
"name": "Set level",
|
||||||
|
"description": "Sets the log level for one or more integrations."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"selector": {
|
||||||
|
"level": {
|
||||||
|
"options": {
|
||||||
|
"debug": "Debug",
|
||||||
|
"info": "Info",
|
||||||
|
"warning": "Warning",
|
||||||
|
"error": "Error",
|
||||||
|
"fatal": "Fatal",
|
||||||
|
"critical": "Critical"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -173,7 +173,7 @@ _SERVICE_SCHEMA = vol.Schema(
|
|||||||
extra=vol.ALLOW_EXTRA,
|
extra=vol.ALLOW_EXTRA,
|
||||||
)
|
)
|
||||||
|
|
||||||
_SERVICES_SCHEMA = vol.Schema({cv.slug: _SERVICE_SCHEMA})
|
_SERVICES_SCHEMA = vol.Schema({cv.slug: vol.Any(None, _SERVICE_SCHEMA)})
|
||||||
|
|
||||||
|
|
||||||
class ServiceParams(TypedDict):
|
class ServiceParams(TypedDict):
|
||||||
|
@ -677,6 +677,9 @@ async def test_async_get_all_descriptions_failing_integration(
|
|||||||
with patch(
|
with patch(
|
||||||
"homeassistant.helpers.service.async_get_integrations",
|
"homeassistant.helpers.service.async_get_integrations",
|
||||||
return_value={"logger": ImportError},
|
return_value={"logger": ImportError},
|
||||||
|
), patch(
|
||||||
|
"homeassistant.helpers.service.translation.async_get_translations",
|
||||||
|
return_value={},
|
||||||
):
|
):
|
||||||
descriptions = await service.async_get_all_descriptions(hass)
|
descriptions = await service.async_get_all_descriptions(hass)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user