Skip to content

Commit 45adcc8

Browse files
dale3hballoob
authored andcommitted
Add set_default_level documentation (home-assistant#5460)
* Add set_default_level documentation * ✏️ Tweaks * More logger changes
1 parent 46a1b6d commit 45adcc8

File tree

1 file changed

+47
-10
lines changed

1 file changed

+47
-10
lines changed

source/_components/logger.markdown

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ logo: home-assistant.png
1111
ha_category: "Utility"
1212
---
1313

14-
The logger component lets you define the level of logging activities in Home Assistant.
14+
The `logger` component lets you define the level of logging activities in Home Assistant.
1515

16-
To enable the logger in your installation, add the following to your `configuration.yaml` file:
16+
To enable the `logger` component in your installation, add the following to your `configuration.yaml` file:
1717

18-
To have a full log and log everything only this entry is needed (without any qualifier):
1918
```yaml
19+
# Example configuration.yaml entry
2020
logger:
2121
```
22-
To log all messages and ignore events lower than critical for specified components.
22+
23+
To log all messages and ignore events lower than critical for specified components:
2324
2425
```yaml
2526
# Example configuration.yaml entry
@@ -30,7 +31,7 @@ logger:
3031
homeassistant.components.camera: critical
3132
```
3233
33-
To ignore all messages lower than critical and log event for specified components.
34+
To ignore all messages lower than critical and log event for specified components:
3435
3536
```yaml
3637
# Example configuration.yaml entry
@@ -43,7 +44,25 @@ logger:
4344
homeassistant.components.camera: critical
4445
```
4546
46-
Possible log severities are:
47+
{% configuration %}
48+
default:
49+
description: Default log level.
50+
required: false
51+
type: '[log_level](#log-levels)'
52+
default: debug
53+
logs:
54+
description: List of components and their log level.
55+
required: false
56+
type: map
57+
keys:
58+
'<component_namespace>':
59+
description: Logger namespace of the component.
60+
type: '[log_level](#log-levels)'
61+
{% endconfiguration %}
62+
63+
### {% linkable_title Log Levels %}
64+
65+
Possible log severity levels are:
4766
4867
- critical
4968
- fatal
@@ -53,11 +72,26 @@ Possible log severities are:
5372
- info
5473
- debug
5574
- notset
56-
75+
76+
## {% linkable_title Services %}
77+
78+
### {% linkable_title Service `set_default_level` %}
79+
80+
You can alter the default log level (for components without a specified log
81+
level) using the service `logger.set_default_level`.
82+
83+
An example call might look like this:
84+
85+
```yaml
86+
service: logger.set_default_level
87+
data:
88+
level: info
89+
```
90+
5791
### {% linkable_title Service `set_level` %}
5892

5993
You can alter log level for one or several components using the service
60-
``logger.set_level``. It accepts the same format as ``logs`` in the configuration.
94+
`logger.set_level`. It accepts the same format as `logs` in the configuration.
6195

6296
An example call might look like this:
6397

@@ -68,15 +102,18 @@ data:
68102
homeassistant.components.media_player.yamaha: debug
69103
```
70104

71-
The log information are stored in the [configuration directory](/docs/configuration/) as `home-assistant.log` and you can read it with the command-line tool `cat` or follow it dynamically with `tail -f`.
105+
The log information are stored in the [configuration directory](/docs/configuration/)
106+
as `home-assistant.log` and you can read it with the command-line tool `cat` or
107+
follow it dynamically with `tail -f`.
72108

73109
If you are a Hassbian user you can use the example below:
74110

75111
```bash
76112
$ tail -f /home/homeassistant/.homeassistant/home-assistant.log
77113
```
78114

79-
If you are a Hass.io user you can use the example below, whenlogged in through the ssh addon:
115+
If you are a Hass.io user, you can use the example below, when logged in through
116+
the [SSH add-on](/addons/ssh/):
80117

81118
```bash
82119
$ tail -f /config/home-assistant.log

0 commit comments

Comments
 (0)