logging: allow disabling auto-start of UART backend
This allows putting the UART backend on a serial device that has to be quiet unless logging is explicitly enabled at runtime. Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
This commit is contained in:
parent
52dfd528b8
commit
7e0e9d0d7e
2 changed files with 11 additions and 1 deletions
|
@ -24,6 +24,14 @@ config LOG_BACKEND_UART_BUFFER_SIZE
|
|||
Sets the number of bytes which can be buffered in RAM before log_output_flush
|
||||
is automatically called on the backend.
|
||||
|
||||
config LOG_BACKEND_UART_AUTOSTART
|
||||
bool "Automatically start UART backend"
|
||||
default y
|
||||
help
|
||||
When enabled automatically start the UART logging backend on
|
||||
application start. When disabled, the application needs to start
|
||||
the backend manually using log_backend_enable().
|
||||
|
||||
backend = UART
|
||||
backend-str = uart
|
||||
source "subsys/logging/Kconfig.template.log_format_config"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/uart.h>
|
||||
#include <zephyr/sys/util_macro.h>
|
||||
#include <zephyr/sys/__assert.h>
|
||||
LOG_MODULE_REGISTER(log_uart);
|
||||
|
||||
|
@ -161,4 +162,5 @@ const struct log_backend_api log_backend_uart_api = {
|
|||
.format_set = format_set,
|
||||
};
|
||||
|
||||
LOG_BACKEND_DEFINE(log_backend_uart, log_backend_uart_api, true);
|
||||
LOG_BACKEND_DEFINE(log_backend_uart, log_backend_uart_api,
|
||||
IS_ENABLED(CONFIG_LOG_BACKEND_UART_AUTOSTART));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue