logging: Add autostart option to LOG_BACKEND_DEFINE

Extended macro to accept flag indicating if given backend must be
initialized and enabled when log subsystem starts. Typically, simple
backends will have autostart flag set. More complex may require
explicit enabling (e.g. shell over BLE can only be enabled when
BLE connection is established).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2018-10-11 06:28:18 +02:00 committed by Jukka Rissanen
commit 5f6070e2f7
7 changed files with 24 additions and 16 deletions

View file

@ -56,7 +56,7 @@ int shell_log_backend_output_func(u8_t *data, size_t length, void *ctx);
*/
#if CONFIG_LOG
#define SHELL_LOG_BACKEND_DEFINE(_name, _buf, _size) \
LOG_BACKEND_DEFINE(_name##_backend, log_backend_shell_api); \
LOG_BACKEND_DEFINE(_name##_backend, log_backend_shell_api, false); \
K_FIFO_DEFINE(_name##_fifo); \
LOG_OUTPUT_DEFINE(_name##_log_output, shell_log_backend_output_func, \
_buf, _size); \