shell: Improve handling of log messages
If burst of log messages was passed to the shell log backend, it was likely that messages were lost because shell had no means to control arrivals of log messages. Added log message enqueueing timeout to the shell instance to allow blocking logger thread if short-term arrival rate exceeded shell capabilities. Added kconfig option for setting log message queue size and timeout in RTT and UART instances. Added section in shell documentation which explains interaction between the logger and shell instance acting as a logger backend. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
801b54edb9
commit
08f0d93cbb
10 changed files with 87 additions and 20 deletions
|
@ -49,11 +49,13 @@ static void msg_to_fifo(const struct shell *shell,
|
|||
{
|
||||
int err;
|
||||
|
||||
err = k_msgq_put(shell->log_backend->msgq, &msg, K_NO_WAIT);
|
||||
err = k_msgq_put(shell->log_backend->msgq, &msg,
|
||||
shell->log_backend->timeout);
|
||||
|
||||
switch (err) {
|
||||
case 0:
|
||||
break;
|
||||
case -EAGAIN:
|
||||
case -ENOMSG:
|
||||
{
|
||||
struct log_msg *old_msg;
|
||||
|
@ -71,9 +73,9 @@ static void msg_to_fifo(const struct shell *shell,
|
|||
|
||||
err = k_msgq_put(shell->log_backend->msgq, &msg, K_NO_WAIT);
|
||||
if (err) {
|
||||
/* Rather unusual sitaution as we just freed one element
|
||||
* and there is no other context that puts into the
|
||||
* mesq. */
|
||||
/* Unexpected case as we just freed one element and
|
||||
* there is no other context that puts into the msgq.
|
||||
*/
|
||||
__ASSERT_NO_MSG(0);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue