shell: log backend minor improvements

Replace direct setting of the internal shell flag with a
dedicated function for this.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2021-09-20 14:22:38 +02:00 committed by Christopher Friedt
commit 3ebe9c9ea1

View file

@ -157,7 +157,7 @@ bool z_shell_log_backend_process(const struct shell_log_backend *backend)
(const struct shell *)backend->backend->cb->ctx;
uint32_t dropped;
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
shell->ctx->internal.flags.use_colors;
z_flag_use_colors_get(shell);
dropped = atomic_set(&backend->control_block->dropped_cnt, 0);
if (dropped) {
@ -193,7 +193,7 @@ static void put(const struct log_backend *const backend, struct log_msg *msg)
{
const struct shell *shell = (const struct shell *)backend->cb->ctx;
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
shell->ctx->internal.flags.use_colors;
z_flag_use_colors_get(shell);
struct k_poll_signal *signal;
log_msg_get(msg);
@ -387,7 +387,7 @@ static bool process_msg2_from_buffer(const struct shell *shell)
const struct log_output *log_output = log_backend->log_output;
union log_msg2_generic *msg;
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
shell->ctx->internal.flags.use_colors;
z_flag_use_colors_get(shell);
msg = (union log_msg2_generic *)mpsc_pbuf_claim(mpsc_buffer);
if (!msg) {
@ -409,7 +409,7 @@ static void log2_process(const struct log_backend *const backend,
struct mpsc_pbuf_buffer *mpsc_buffer = log_backend->mpsc_buffer;
const struct log_output *log_output = log_backend->log_output;
bool colors = IS_ENABLED(CONFIG_SHELL_VT100_COLORS) &&
shell->ctx->internal.flags.use_colors;
z_flag_use_colors_get(shell);
struct k_poll_signal *signal;
switch (shell->log_backend->control_block->state) {