shell: Add option to format logging timestamp
Add option to control formatting of the logging timestamp. By default formatting is enabled which maintains backward compatibility. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
5c27067dcd
commit
64ab22bf43
2 changed files with 10 additions and 1 deletions
|
@ -238,6 +238,14 @@ config SHELL_LOG_BACKEND
|
||||||
using the shell backend's LOG_LEVEL option
|
using the shell backend's LOG_LEVEL option
|
||||||
(e.g. CONFIG_SHELL_TELNET_INIT_LOG_LEVEL_NONE=y).
|
(e.g. CONFIG_SHELL_TELNET_INIT_LOG_LEVEL_NONE=y).
|
||||||
|
|
||||||
|
config SHELL_LOG_FORMAT_TIMESTAMP
|
||||||
|
bool "Format timestamp"
|
||||||
|
default y
|
||||||
|
depends on SHELL_LOG_BACKEND
|
||||||
|
help
|
||||||
|
Enable timestamp formatting.
|
||||||
|
|
||||||
|
|
||||||
source "subsys/shell/modules/Kconfig"
|
source "subsys/shell/modules/Kconfig"
|
||||||
|
|
||||||
endif # SHELL
|
endif # SHELL
|
||||||
|
|
|
@ -158,7 +158,8 @@ static void process_log_msg(const struct shell *sh,
|
||||||
unsigned int key = 0;
|
unsigned int key = 0;
|
||||||
uint32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
uint32_t flags = LOG_OUTPUT_FLAG_LEVEL |
|
||||||
LOG_OUTPUT_FLAG_TIMESTAMP |
|
LOG_OUTPUT_FLAG_TIMESTAMP |
|
||||||
LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP;
|
(IS_ENABLED(CONFIG_SHELL_LOG_FORMAT_TIMESTAMP) ?
|
||||||
|
LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP : 0);
|
||||||
|
|
||||||
if (colors) {
|
if (colors) {
|
||||||
flags |= LOG_OUTPUT_FLAG_COLORS;
|
flags |= LOG_OUTPUT_FLAG_COLORS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue