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:
parent
27459a13e4
commit
87d177a6fb
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue