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:
Krzysztof Chruscinski 2022-01-12 15:52:48 +01:00 committed by Anas Nashif
commit 262cc55609
47 changed files with 199 additions and 178 deletions

View file

@ -43,7 +43,7 @@
#define CHAR_BUF_SIZE \
((IS_ENABLED(CONFIG_LOG_BACKEND_RTT_MODE_BLOCK) && \
!IS_ENABLED(CONFIG_LOG_IMMEDIATE)) ? \
!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) ? \
CONFIG_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE : 1)
#define RTT_LOCK() \
@ -75,7 +75,7 @@ static int line_out_drop_mode(void);
static inline bool is_sync_mode(void)
{
return IS_ENABLED(CONFIG_LOG_IMMEDIATE) || panic_mode;
return IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) || panic_mode;
}
static inline bool is_panic_mode(void)
@ -327,14 +327,14 @@ static void process(const struct log_backend *const backend,
const struct log_backend_api log_backend_rtt_api = {
.process = IS_ENABLED(CONFIG_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) ?
sync_string : NULL,
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ?
.put_sync_hexdump = IS_ENABLED(CONFIG_LOG1_IMMEDIATE) ?
sync_hexdump : NULL,
.panic = panic,
.init = log_backend_rtt_init,
.dropped = IS_ENABLED(CONFIG_LOG_IMMEDIATE) ? NULL : dropped,
.dropped = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ? NULL : dropped,
};
LOG_BACKEND_DEFINE(log_backend_rtt, log_backend_rtt_api, true);