logging: Add configurable logging thread delay
This patch adds confiugurable delay when starting log processing thread. Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
This commit is contained in:
parent
dc633856d7
commit
6f4f1dc230
3 changed files with 14 additions and 1 deletions
|
@ -156,6 +156,9 @@ threshold is used by the internal thread.
|
||||||
:kconfig:`CONFIG_LOG_PROCESS_THREAD`: When enabled, logging thread is created
|
:kconfig:`CONFIG_LOG_PROCESS_THREAD`: When enabled, logging thread is created
|
||||||
which handles log processing.
|
which handles log processing.
|
||||||
|
|
||||||
|
:kconfig:`CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS`: Delay in milliseconds
|
||||||
|
after which logging thread is started.
|
||||||
|
|
||||||
:kconfig:`CONFIG_LOG_BUFFER_SIZE`: Number of bytes dedicated for the message pool.
|
:kconfig:`CONFIG_LOG_BUFFER_SIZE`: Number of bytes dedicated for the message pool.
|
||||||
Single message capable of storing standard log with up to 3 arguments or hexdump
|
Single message capable of storing standard log with up to 3 arguments or hexdump
|
||||||
message with 12 bytes of data take 32 bytes. In v2 it indicates buffer size
|
message with 12 bytes of data take 32 bytes. In v2 it indicates buffer size
|
||||||
|
|
|
@ -67,6 +67,13 @@ config LOG_PROCESS_THREAD
|
||||||
|
|
||||||
if LOG_PROCESS_THREAD
|
if LOG_PROCESS_THREAD
|
||||||
|
|
||||||
|
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
|
||||||
|
int "Set log processing thread startup delay"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Log processing thread starts after requested delay given in
|
||||||
|
milliseconds. When started, thread process any buffered messages.
|
||||||
|
|
||||||
config LOG_PROCESS_THREAD_SLEEP_MS
|
config LOG_PROCESS_THREAD_SLEEP_MS
|
||||||
int "Set internal log processing thread sleep period"
|
int "Set internal log processing thread sleep period"
|
||||||
default 1000
|
default 1000
|
||||||
|
|
|
@ -1271,7 +1271,10 @@ static int enable_logger(const struct device *arg)
|
||||||
k_thread_create(&logging_thread, logging_stack,
|
k_thread_create(&logging_thread, logging_stack,
|
||||||
K_KERNEL_STACK_SIZEOF(logging_stack),
|
K_KERNEL_STACK_SIZEOF(logging_stack),
|
||||||
log_process_thread_func, NULL, NULL, NULL,
|
log_process_thread_func, NULL, NULL, NULL,
|
||||||
K_LOWEST_APPLICATION_THREAD_PRIO, 0, K_NO_WAIT);
|
K_LOWEST_APPLICATION_THREAD_PRIO, 0,
|
||||||
|
COND_CODE_1(CONFIG_LOG_PROCESS_THREAD,
|
||||||
|
K_MSEC(CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS),
|
||||||
|
K_NO_WAIT));
|
||||||
k_thread_name_set(&logging_thread, "logging");
|
k_thread_name_set(&logging_thread, "logging");
|
||||||
} else {
|
} else {
|
||||||
log_init();
|
log_init();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue