zephyr/subsys/logging/log_output_custom.c
Lucas Denefle 2efc9cc847 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>
2022-10-06 19:15:35 -04:00

23 lines
494 B
C

/*
* Copyright (c) 2022 Converge
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/logging/log.h>
#include <zephyr/logging/log_output.h>
static log_format_func_t log_custom_format_func;
void log_custom_output_msg_process(const struct log_output *output, struct log_msg *msg,
uint32_t flags)
{
if (log_custom_format_func) {
log_custom_format_func(output, msg, flags);
}
}
void log_custom_output_msg_set(log_format_func_t format)
{
log_custom_format_func = format;
}