Commit 05b854c1 authored by Krzysztof Chruściński's avatar Krzysztof Chruściński Committed by Jukka Rissanen
Browse files

logging: Postpone log processing when no backends enabled



In initial state of the system it is possible that no backends are
yet enabled and log processing is triggered. In that case logs were
discarded. A flag has been added to the log core to do processing
only if at least one backend is enabled. It is applicable only to
initial phase. If backends are disabled in application lifetime
logs will be discarded.

Signed-off-by: default avatarKrzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
parent 5f6070e2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ static u8_t __noinit __aligned(sizeof(u32_t))
static struct log_list_t list;
static atomic_t initialized;
static bool panic_mode;
static bool backend_attached;
static atomic_t buffered_cnt;
static k_tid_t proc_tid;

@@ -278,6 +279,7 @@ void log_init(void)
			}

			log_backend_activate(backend, NULL);
			backend_attached = true;
		}
	}
}
@@ -375,6 +377,9 @@ bool log_process(bool bypass)
{
	struct log_msg *msg;

	if (!backend_attached) {
		return false;
	}
	unsigned int key = irq_lock();

	msg = log_list_head_get(&list);
@@ -477,6 +482,7 @@ void log_backend_enable(struct log_backend const *const backend,
{
	backend_filter_set(backend, level);
	log_backend_activate(backend, ctx);
	backend_attached = true;
}

void log_backend_disable(struct log_backend const *const backend)