logging: Deprecate v1, default to v2
Reduced logging mode selection to deferred, immediate, minimal and frontend. Decoupled logging version from mode and created CONFIG_LOG1 which can be used to explicitly select deprecated version. From now on, chosing CONFIG_LOG_MODE_{IMMEDIATE,DEFERRED} will result in version2. Deprecated CONFIG_LOG2_MODE_{IMMEDIATE,DEFERRED} with cmake warning. Codebase adapted to those changes. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
dd4035c624
commit
262cc55609
47 changed files with 199 additions and 178 deletions
|
@ -30,14 +30,14 @@ static struct log_msg *msg_from_fifo(const struct shell_log_backend *backend)
|
|||
/* Set fifo clean state (in case of deferred mode). */
|
||||
static void fifo_reset(const struct shell_log_backend *backend)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_LOG2_MODE_DEFERRED)) {
|
||||
if (IS_ENABLED(CONFIG_LOG2_DEFERRED)) {
|
||||
mpsc_pbuf_init(backend->mpsc_buffer,
|
||||
backend->mpsc_buffer_config);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Flush pending log messages without processing. */
|
||||
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
||||
if (IS_ENABLED(CONFIG_LOG1_DEFERRED)) {
|
||||
struct log_msg *msg;
|
||||
|
||||
while ((msg = msg_from_fifo(backend)) != NULL) {
|
||||
|
@ -51,7 +51,7 @@ void z_shell_log_backend_enable(const struct shell_log_backend *backend,
|
|||
{
|
||||
int err = 0;
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG_IMMEDIATE)) {
|
||||
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
||||
const struct shell *shell;
|
||||
|
||||
shell = (const struct shell *)ctx;
|
||||
|
@ -176,7 +176,7 @@ bool z_shell_log_backend_process(const struct shell_log_backend *backend)
|
|||
}
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG2_MODE_DEFERRED)) {
|
||||
if (IS_ENABLED(CONFIG_LOG2_DEFERRED)) {
|
||||
return process_msg2_from_buffer(shell);
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ static void panic(const struct log_backend *const backend)
|
|||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
||||
int err;
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG_IMMEDIATE)) {
|
||||
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -300,11 +300,11 @@ static void panic(const struct log_backend *const backend)
|
|||
z_shell_op_cursor_horiz_move(shell,
|
||||
-shell->ctx->vt100_ctx.cons.cur_x);
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG2_MODE_DEFERRED)) {
|
||||
if (IS_ENABLED(CONFIG_LOG2_DEFERRED)) {
|
||||
while (process_msg2_from_buffer(shell)) {
|
||||
/* empty */
|
||||
}
|
||||
} else if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
||||
} else if (IS_ENABLED(CONFIG_LOG1_DEFERRED)) {
|
||||
while (z_shell_log_backend_process(
|
||||
shell->log_backend)) {
|
||||
/* empty */
|
||||
|
@ -416,7 +416,7 @@ static void log2_process(const struct log_backend *const backend,
|
|||
|
||||
switch (shell->log_backend->control_block->state) {
|
||||
case SHELL_LOG_BACKEND_ENABLED:
|
||||
if (IS_ENABLED(CONFIG_LOG_IMMEDIATE)) {
|
||||
if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) {
|
||||
process_log_msg2(shell, log_output, msg, true, colors);
|
||||
} else {
|
||||
copy_to_pbuffer(mpsc_buffer, msg,
|
||||
|
@ -445,10 +445,10 @@ static void log2_process(const struct log_backend *const backend,
|
|||
|
||||
const struct log_backend_api log_backend_shell_api = {
|
||||
.process = IS_ENABLED(CONFIG_LOG2) ? log2_process : NULL,
|
||||
.put = IS_ENABLED(CONFIG_LOG_MODE_DEFERRED) ? put : NULL,
|
||||
.put_sync_string = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ?
|
||||
.put = IS_ENABLED(CONFIG_LOG1_DEFERRED) ? put : NULL,
|
||||
.put_sync_string = IS_ENABLED(CONFIG_LOG1_IMMEDIATE) ?
|
||||
put_sync_string : NULL,
|
||||
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ?
|
||||
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG1_IMMEDIATE) ?
|
||||
put_sync_hexdump : NULL,
|
||||
.dropped = dropped,
|
||||
.panic = panic,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue