mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 08:29:52 +00:00
[ncp] config option for max log string size in otNcpPlatLogv() (#2603)
This commit adds `OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE` as a config option to set the max log string size supported by NCP `otNcpPlatLogv()`. This commit also increases the default to 150 characters.
This commit is contained in:
committed by
Jonathan Hui
parent
3e4ed6cc98
commit
157d74d3ef
+10
-10
@@ -84,6 +84,16 @@ void otNcpInit(otInstance *aInstance);
|
||||
*/
|
||||
otError otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen);
|
||||
|
||||
/**
|
||||
* Writes OpenThread Log using `otNcpStreamWrite`.
|
||||
*
|
||||
* @param[in] aLogLevel The log level.
|
||||
* @param[in] aLogRegion The log region.
|
||||
* @param[in] aFormat A pointer to the format string.
|
||||
* @param[in] aArgs va_list matching aFormat.
|
||||
*/
|
||||
void otNcpPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs);
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// Peek/Poke memory access control delegates
|
||||
|
||||
@@ -202,16 +212,6 @@ void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix);
|
||||
*/
|
||||
void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers);
|
||||
|
||||
/**
|
||||
* Callback to write the OpenThread Log to the NCP Spinel Tunnel.
|
||||
*
|
||||
* @param[in] aLogLevel The log level.
|
||||
* @param[in] aLogRegion The log region.
|
||||
* @param[in] aFormat A pointer to the format string.
|
||||
* @param[in] aArgs va_list matching aFormat.
|
||||
*/
|
||||
void otNcpPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
@@ -855,6 +855,16 @@
|
||||
#define OPENTHREAD_CONFIG_NCP_SPINEL_ENCRYPTER_EXTRA_DATA_SIZE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE
|
||||
*
|
||||
* The maximum OpenThread log string size (number of chars) supported by NCP using Spinel `StreamWrite`.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE
|
||||
#define OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE 150
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
*
|
||||
|
||||
@@ -2163,7 +2163,7 @@ otError otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen)
|
||||
|
||||
extern "C" void otNcpPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs)
|
||||
{
|
||||
char logString[128];
|
||||
char logString[OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE];
|
||||
int charsWritten;
|
||||
|
||||
if ((charsWritten = vsnprintf(logString, sizeof(logString), aFormat, aArgs)) > 0)
|
||||
|
||||
Reference in New Issue
Block a user