[logging] add optional otPlatLogLine() & use it in NCP/CLI (#5704)

This commit adds a new platform function `otPlatLogLine()`. This
function is optional and if not implemented by platform layer, a
default weak implementation is provided and used by the OpenThread
core using `otPlatLog()`.The new function is used by OpenThread core
when the feature `OPENTHREAD_CONFIG_LOG_DEFINE_AS_MACRO_ONLY` is not
enabled (which is the default behavior). In this case, the OT core
itself will prepare a full log line.

This commit also adds implementations of the new platform function for
the NCP and CLI modules.
This commit is contained in:
Abtin Keshavarzian
2020-10-27 16:59:47 -07:00
committed by GitHub
parent 5711151d08
commit 9964e5ee39
7 changed files with 60 additions and 5 deletions
+6 -4
View File
@@ -133,13 +133,15 @@ pseudo_reset:
#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_APP
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
OT_UNUSED_VARIABLE(aFormat);
va_list ap;
va_start(ap, aFormat);
otCliPlatLogv(aLogLevel, aLogRegion, aFormat, ap);
va_end(ap);
}
void otPlatLogLine(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aLogLine)
{
otCliPlatLogLine(aLogLevel, aLogRegion, aLogLine);
}
#endif