mirror of
https://github.com/espressif/openthread.git
synced 2026-07-09 13:50:28 +00:00
Default Logging Support (#1054)
* Add support for NCP passing logs up in the SPINEL_PROP_STREAM_DEBUG command.
This commit is contained in:
+10
-76
@@ -228,96 +228,30 @@ void Uart::SendDoneTask(void)
|
||||
Send();
|
||||
}
|
||||
|
||||
#if OPENTHREAD_ENABLE_CLI_LOGGING
|
||||
#if OPENTHREAD_ENABLE_DEFAULT_LOGGING
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void otCliLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aAp)
|
||||
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
|
||||
{
|
||||
if (NULL == Uart::sUartServer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aLogLevel)
|
||||
{
|
||||
case kLogLevelNone:
|
||||
Uart::sUartServer->OutputFormat("NONE ");
|
||||
break;
|
||||
|
||||
case kLogLevelCrit:
|
||||
Uart::sUartServer->OutputFormat("CRIT ");
|
||||
break;
|
||||
|
||||
case kLogLevelWarn:
|
||||
Uart::sUartServer->OutputFormat("WARN ");
|
||||
break;
|
||||
|
||||
case kLogLevelInfo:
|
||||
Uart::sUartServer->OutputFormat("INFO ");
|
||||
break;
|
||||
|
||||
case kLogLevelDebg:
|
||||
Uart::sUartServer->OutputFormat("DEBG ");
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aLogRegion)
|
||||
{
|
||||
case kLogRegionApi:
|
||||
Uart::sUartServer->OutputFormat("API ");
|
||||
break;
|
||||
|
||||
case kLogRegionMle:
|
||||
Uart::sUartServer->OutputFormat("MLE ");
|
||||
break;
|
||||
|
||||
case kLogRegionArp:
|
||||
Uart::sUartServer->OutputFormat("ARP ");
|
||||
break;
|
||||
|
||||
case kLogRegionNetData:
|
||||
Uart::sUartServer->OutputFormat("NETD ");
|
||||
break;
|
||||
|
||||
case kLogRegionIp6:
|
||||
Uart::sUartServer->OutputFormat("IPV6 ");
|
||||
break;
|
||||
|
||||
case kLogRegionIcmp:
|
||||
Uart::sUartServer->OutputFormat("ICMP ");
|
||||
break;
|
||||
|
||||
case kLogRegionMac:
|
||||
Uart::sUartServer->OutputFormat("MAC ");
|
||||
break;
|
||||
|
||||
case kLogRegionMem:
|
||||
Uart::sUartServer->OutputFormat("MEM ");
|
||||
break;
|
||||
|
||||
case kLogRegionNcp:
|
||||
Uart::sUartServer->OutputFormat("NCP ");
|
||||
break;
|
||||
|
||||
case kLogRegionMeshCoP:
|
||||
Uart::sUartServer->OutputFormat("MCOP ");
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
Uart::sUartServer->OutputFormatV(aFormat, aAp);
|
||||
va_list args;
|
||||
va_start(args, aFormat);
|
||||
Uart::sUartServer->OutputFormatV(aFormat, args);
|
||||
Uart::sUartServer->OutputFormat("\r\n");
|
||||
va_end(args);
|
||||
|
||||
(void)aLogLevel;
|
||||
(void)aLogRegion;
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
#endif // OPENTHREAD_ENABLE_CLI_LOGGING
|
||||
#endif // OPENTHREAD_ENABLE_DEFAULT_LOGGING
|
||||
|
||||
} // namespace Cli
|
||||
} // namespace Thread
|
||||
|
||||
Reference in New Issue
Block a user