2018-05-13 11:37:02 +02:00
|
|
|
|
Logger Component
|
|
|
|
|
================
|
|
|
|
|
|
|
|
|
|
The logger component automatically logs all log messages through the
|
|
|
|
|
serial port and through MQTT topics. By default, all logs with a
|
|
|
|
|
severity higher than ``DEBUG`` will be shown. Decreasing the log level
|
|
|
|
|
can help with the performance of the application and memory size.
|
|
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
|
logger:
|
|
|
|
|
level: DEBUG
|
|
|
|
|
|
|
|
|
|
Configuration variables:
|
2018-08-24 22:44:01 +02:00
|
|
|
|
------------------------
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
|
|
- **baud_rate** (*Optional*, int): The baud rate to use for the serial
|
2018-08-27 13:21:30 +02:00
|
|
|
|
UART port. Defaults to ``115200``. Set to ``0`` to disable logging via UART.
|
2018-05-13 11:37:02 +02:00
|
|
|
|
- **tx_buffer_size** (*Optional*, string): The size of the buffer used
|
|
|
|
|
for log messages. Decrease this if you’re having memory problems.
|
|
|
|
|
Defaults to 512.
|
|
|
|
|
- **level** (*Optional*, string): The global log level. Any log message
|
|
|
|
|
with a lower severity will not be shown. Defaults to DEBUG.
|
|
|
|
|
- **logs** (*Optional*, mapping): Manually set the log level for a
|
2018-06-01 18:10:00 +02:00
|
|
|
|
specific component or tag. See :ref:`Manual Log Levels for more
|
|
|
|
|
information <logger-manual_tag_specific_levels>`.
|
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
|
|
|
|
|
|
|
|
|
|
.. _logger-log_levels:
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
|
|
Log Levels
|
2018-08-24 22:44:01 +02:00
|
|
|
|
----------
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
|
|
Possible log levels are (sorted by severity):
|
|
|
|
|
|
|
|
|
|
- ``NONE``
|
|
|
|
|
- ``ERROR``
|
|
|
|
|
- ``WARN``
|
|
|
|
|
- ``INFO``
|
|
|
|
|
- ``DEBUG``
|
|
|
|
|
- ``VERBOSE``
|
2018-05-14 21:15:49 +02:00
|
|
|
|
- ``VERY_VERBOSE``
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
|
.. _logger-manual_tag_specific_levels:
|
|
|
|
|
|
2018-05-13 11:37:02 +02:00
|
|
|
|
Manual Tag-Specific Log Levels
|
2018-08-24 22:44:01 +02:00
|
|
|
|
------------------------------
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
|
|
If some component is spamming the logs and you want to manually set the
|
|
|
|
|
log level for it, first identify the tag of the log messages in question
|
|
|
|
|
and then disable them in your configuration.
|
|
|
|
|
|
|
|
|
|
Suppose we want to have verbose log messages globally, but the MQTT
|
|
|
|
|
client spams too much. In the following example, we’d first see that the
|
|
|
|
|
tag of the MQTT client is ``mqtt.client`` (before the first colon) and
|
|
|
|
|
the tag for MQTT components is ``mqtt.component``.
|
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
|
.. figure:: images/logger-manual_log_level.png
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
|
|
|
|
Next, we can manually set the log levels in the configuration like this:
|
|
|
|
|
|
|
|
|
|
.. code:: yaml
|
|
|
|
|
|
|
|
|
|
logger:
|
|
|
|
|
level: VERBOSE
|
|
|
|
|
logs:
|
|
|
|
|
mqtt.component: DEBUG
|
|
|
|
|
mqtt.client: ERROR
|
|
|
|
|
|
|
|
|
|
Please note that the global log level determines what log messages are
|
|
|
|
|
saved in the binary. So for example a ``INFO`` global log message will
|
|
|
|
|
purge all ``DEBUG`` log statements from the binary in order to conserve
|
|
|
|
|
space. This however means that you cannot set tag-specific log levels
|
|
|
|
|
that have a lower severity than the global log level.
|
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
|
See Also
|
|
|
|
|
--------
|
2018-05-13 11:37:02 +02:00
|
|
|
|
|
2018-06-01 18:10:00 +02:00
|
|
|
|
- :doc:`API Reference </api/core/log>`
|
2018-06-04 08:17:22 +02:00
|
|
|
|
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/logger.rst>`__
|