mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +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:
|
||||
name: Set default level
|
||||
description: Set the default log level for integrations.
|
||||
fields:
|
||||
level:
|
||||
name: Level
|
||||
description: Default severity level for all integrations.
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- label: "Debug"
|
||||
value: "debug"
|
||||
- label: "Info"
|
||||
value: "info"
|
||||
- label: "Warning"
|
||||
value: "warning"
|
||||
- label: "Error"
|
||||
value: "error"
|
||||
- label: "Fatal"
|
||||
value: "fatal"
|
||||
- label: "Critical"
|
||||
value: "critical"
|
||||
|
||||
- "debug"
|
||||
- "info"
|
||||
- "warning"
|
||||
- "error"
|
||||
- "fatal"
|
||||
- "critical"
|
||||
translation_key: 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,
|
||||
)
|
||||
|
||||
_SERVICES_SCHEMA = vol.Schema({cv.slug: _SERVICE_SCHEMA})
|
||||
_SERVICES_SCHEMA = vol.Schema({cv.slug: vol.Any(None, _SERVICE_SCHEMA)})
|
||||
|
||||
|
||||
class ServiceParams(TypedDict):
|
||||
|
@ -677,6 +677,9 @@ async def test_async_get_all_descriptions_failing_integration(
|
||||
with patch(
|
||||
"homeassistant.helpers.service.async_get_integrations",
|
||||
return_value={"logger": ImportError},
|
||||
), patch(
|
||||
"homeassistant.helpers.service.translation.async_get_translations",
|
||||
return_value={},
|
||||
):
|
||||
descriptions = await service.async_get_all_descriptions(hass)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user