logging: Initialize backends with autostart flag set

Added check which ensures that only backends with autostart
flag set are enabled automatically by the logging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2022-07-11 11:23:20 +02:00 committed by Fabio Baltieri
commit 60ca7899c7

View file

@ -236,7 +236,7 @@ static uint32_t activate_foreach_backend(uint32_t mask)
const struct log_backend *backend = log_backend_get(i); const struct log_backend *backend = log_backend_get(i);
mask_cpy &= ~BIT(i); mask_cpy &= ~BIT(i);
if (log_backend_is_ready(backend) == 0) { if (backend->autostart && (log_backend_is_ready(backend) == 0)) {
mask &= ~BIT(i); mask &= ~BIT(i);
log_backend_enable(backend, log_backend_enable(backend,
backend->cb->ctx, backend->cb->ctx,