[cli] new config to log input command and the resulting output (#6827)

This commit adds `OPENTHREAD_CONFIG_CLI_LOG_INPUT_OUTPUT_ENABLE`
option which configures the CLI module to log its input command
string and the resulting output. This is done in addition to emitting
the output string to the console. By default this config is enabled
on all POSIX based platforms and when `LOG_OUTPUT` is not set to use
CLI console itself.
This commit is contained in:
Abtin Keshavarzian
2021-07-20 18:53:27 -07:00
committed by GitHub
parent ead65718e2
commit cbd9661308
4 changed files with 165 additions and 29 deletions
-28
View File
@@ -199,34 +199,6 @@ static otError ProcessCommand(void)
sRxBuffer[--sRxLength] = '\0';
}
#if OPENTHREAD_CONFIG_LOG_OUTPUT != OPENTHREAD_CONFIG_LOG_OUTPUT_NONE
/*
* Note this is here for this reason:
*
* TEXT (command) input ... in a test automation script occurs
* rapidly and often without gaps between the command and the
* terminal CR
*
* In contrast as a human is typing there is a delay between the
* last character of a command and the terminal CR which executes
* a command.
*
* During that human induced delay a tasklet may be scheduled and
* the LOG becomes confusing and it is hard to determine when
* something happened. Which happened first? the command-CR or
* the tasklet.
*
* Yes, while rare it is a race condition that is hard to debug.
*
* Thus this is here to affirmatively LOG exactly when the CLI
* command is being executed.
*/
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
/* TODO: how exactly do we get the instance here? */
#else
otLogInfoCli("execute command: %s", sRxBuffer);
#endif
#endif
if (sRxLength > 0)
{
otCliInputLine(sRxBuffer);