mirror of
https://github.com/espressif/openthread.git
synced 2026-09-13 20:50:05 +00:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user