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:
parent
83bc07c826
commit
4e32721135
3 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue