Add set_default_level documentation (#5460)

* Add set_default_level documentation

* ✏️ Tweaks

* More logger changes
This commit is contained in:
Dale Higgs 2018-06-21 14:22:17 -05:00 committed by Paulus Schoutsen
parent 46a1b6db4e
commit 45adcc81b8

View File

@ -11,15 +11,16 @@ logo: home-assistant.png
ha_category: "Utility" ha_category: "Utility"
--- ---
The logger component lets you define the level of logging activities in Home Assistant. The `logger` component lets you define the level of logging activities in Home Assistant.
To enable the logger in your installation, add the following to your `configuration.yaml` file: To enable the `logger` component in your installation, add the following to your `configuration.yaml` file:
To have a full log and log everything only this entry is needed (without any qualifier):
```yaml ```yaml
# Example configuration.yaml entry
logger: logger:
``` ```
To log all messages and ignore events lower than critical for specified components.
To log all messages and ignore events lower than critical for specified components:
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
@ -30,7 +31,7 @@ logger:
homeassistant.components.camera: critical homeassistant.components.camera: critical
``` ```
To ignore all messages lower than critical and log event for specified components. To ignore all messages lower than critical and log event for specified components:
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
@ -43,7 +44,25 @@ logger:
homeassistant.components.camera: critical homeassistant.components.camera: critical
``` ```
Possible log severities are: {% configuration %}
default:
description: Default log level.
required: false
type: '[log_level](#log-levels)'
default: debug
logs:
description: List of components and their log level.
required: false
type: map
keys:
'<component_namespace>':
description: Logger namespace of the component.
type: '[log_level](#log-levels)'
{% endconfiguration %}
### {% linkable_title Log Levels %}
Possible log severity levels are:
- critical - critical
- fatal - fatal
@ -54,10 +73,25 @@ Possible log severities are:
- debug - debug
- notset - notset
## {% linkable_title Services %}
### {% linkable_title Service `set_default_level` %}
You can alter the default log level (for components without a specified log
level) using the service `logger.set_default_level`.
An example call might look like this:
```yaml
service: logger.set_default_level
data:
level: info
```
### {% linkable_title Service `set_level` %} ### {% linkable_title Service `set_level` %}
You can alter log level for one or several components using the service You can alter log level for one or several components using the service
``logger.set_level``. It accepts the same format as ``logs`` in the configuration. `logger.set_level`. It accepts the same format as `logs` in the configuration.
An example call might look like this: An example call might look like this:
@ -68,7 +102,9 @@ data:
homeassistant.components.media_player.yamaha: debug homeassistant.components.media_player.yamaha: debug
``` ```
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`. 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`.
If you are a Hassbian user you can use the example below: If you are a Hassbian user you can use the example below:
@ -76,7 +112,8 @@ If you are a Hassbian user you can use the example below:
$ tail -f /home/homeassistant/.homeassistant/home-assistant.log $ tail -f /home/homeassistant/.homeassistant/home-assistant.log
``` ```
If you are a Hass.io user you can use the example below, whenlogged in through the ssh addon: If you are a Hass.io user, you can use the example below, when logged in through
the [SSH add-on](/addons/ssh/):
```bash ```bash
$ tail -f /config/home-assistant.log $ tail -f /config/home-assistant.log