logging: Add buffer flushing on entering panic

It may happen that panic occured while logger backend
was formatting output data. In that case output buffer
could get corrupted as logger assumes that processing
happens in one context only (panic is the only exception).

Added log output buffer flushing on entering panic state.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-01-04 08:52:45 +01:00 committed by Anas Nashif
commit 4e32721135
3 changed files with 3 additions and 1 deletions

View file

@ -81,7 +81,7 @@ static void put(const struct log_backend *const backend,
static void panic(struct log_backend const *const backend)
{
/* Nothing to be done, this backend can always process logs */
log_output_flush(&log_output);
}
static void dropped(const struct log_backend *const backend, u32_t cnt)

View file

@ -232,6 +232,7 @@ static void log_backend_rtt_init(void)
static void panic(struct log_backend const *const backend)
{
log_output_flush(&log_output);
panic_mode = 1;
}

View file

@ -60,6 +60,7 @@ static void log_backend_uart_init(void)
static void panic(struct log_backend const *const backend)
{
log_output_flush(&log_output);
}
static void dropped(const struct log_backend *const backend, u32_t cnt)