logging: allow mulitple log_panic calls

Ensure that only first log_panic() sends panic signal to backends

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2018-09-19 11:14:43 +02:00 committed by Anas Nashif
parent 27459a13e4
commit 87d177a6fb
2 changed files with 8 additions and 2 deletions

View File

@ -64,9 +64,11 @@ void log_thread_set(k_tid_t process_tid);
int log_set_timestamp_func(timestamp_get_t timestamp_getter, u32_t freq);
/**
* @brief Switch logger subsystem to panic mode.
* @brief Switch the logger subsystem to the panic mode.
*
* @details On panic logger subsystem informs all backends about panic mode.
* Returns immediately if the logger is already in the panic mode.
*
* @details On panic the logger subsystem informs all backends about panic mode.
* Backends must switch to blocking mode or halt. All pending logs
* are flushed after switching to panic mode. In panic mode, all log
* messages must be processed in the context of the call.

View File

@ -299,6 +299,10 @@ void log_panic(void)
{
struct log_backend const *backend;
if (panic_mode) {
return;
}
for (int i = 0; i < log_backend_count_get(); i++) {
backend = log_backend_get(i);