shell: Add initial log level for rtt and uart backends

RTT and uart shell backends were started with fixed
log limit set to INF. Configuration has been moved
to Kconfig allowing certain level or default LOG_MAX_LEVEL.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2018-11-16 14:09:31 +01:00 committed by Carles Cufí
commit 8421543f1c
3 changed files with 86 additions and 5 deletions

View file

@ -230,7 +230,13 @@ static int enable_shell_uart(struct device *arg)
ARG_UNUSED(arg);
struct device *dev =
device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
shell_init(&uart_shell, dev, true, true, LOG_LEVEL_INF);
bool log_backend = CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > 0;
u32_t level =
(CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > LOG_LEVEL_DBG) ?
CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL;
shell_init(&uart_shell, dev, true, log_backend, level);
return 0;
}
SYS_INIT(enable_shell_uart, POST_KERNEL, 0);