logging: Allow for compilation without log_output

Add option to Kconfig to enable log_output module. It is used
by most of the backends but it is an optional formatter helper
thus it is possible to run logging without it. One example might
be dictionary based logging which does not format log message
to a readable string.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2022-06-24 07:00:31 +02:00 committed by Carles Cufí
commit e4bd0fceef
7 changed files with 34 additions and 4 deletions

View file

@ -54,7 +54,8 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE),
#endif
static const log_format_func_t format_table[] = {
[LOG_OUTPUT_TEXT] = log_output_msg_process,
[LOG_OUTPUT_TEXT] = IS_ENABLED(CONFIG_LOG_OUTPUT) ?
log_output_msg_process : NULL,
[LOG_OUTPUT_SYST] = IS_ENABLED(CONFIG_LOG_MIPI_SYST_ENABLE) ?
log_output_msg_syst_process : NULL,
[LOG_OUTPUT_DICT] = IS_ENABLED(CONFIG_LOG_DICTIONARY_SUPPORT) ?
@ -330,7 +331,9 @@ int log_set_timestamp_func(log_timestamp_get_t timestamp_getter, uint32_t freq)
}
timestamp_func = timestamp_getter;
log_output_timestamp_freq_set(freq);
if (IS_ENABLED(CONFIG_LOG_OUTPUT)) {
log_output_timestamp_freq_set(freq);
}
return 0;
}