logging: enable setting custom logging output func

To enable custom formatting of the log output while still using existing
backend, this commit adds the `log_output_custom` feature.
To use, register a commit with `log_custom_output_msg_set` then set the
log backend format set using `log_backend_format_set` with
`LOG_OUTPUT_CUSTOM`

Signed-off-by: Lucas Denefle <lucas.denefle@converge.io>
This commit is contained in:
Lucas Denefle 2022-09-01 13:49:35 +01:00 committed by Christopher Friedt
commit 2efc9cc847
10 changed files with 178 additions and 13 deletions

View file

@ -18,6 +18,7 @@
#include <zephyr/logging/log_frontend.h>
#include <zephyr/syscall_handler.h>
#include <zephyr/logging/log_output_dict.h>
#include <zephyr/logging/log_output_custom.h>
#include <zephyr/linker/utils.h>
LOG_MODULE_REGISTER(log);
@ -65,7 +66,9 @@ static const log_format_func_t format_table[] = {
[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) ?
log_dict_output_msg_process : NULL
log_dict_output_msg_process : NULL,
[LOG_OUTPUT_CUSTOM] = IS_ENABLED(CONFIG_LOG_CUSTOM_FORMAT_SUPPORT) ?
log_custom_output_msg_process : NULL,
};
log_format_func_t log_format_func_t_get(uint32_t log_type)