Skip to content

Commit 7f6723f

Browse files
authored
[log] add build option OT_LOG_MAX_SIZE to set the max log string size (openthread#10948)
1 parent d5d6022 commit 7f6723f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

etc/cmake/options.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ ot_string_option(OT_VENDOR_SW_VERSION OPENTHREAD_CONFIG_NET_DIAG_VENDOR_SW_VERSI
333333
set(OT_POWER_SUPPLY_VALUES "BATTERY" "EXTERNAL" "EXTERNAL_STABLE" "EXTERNAL_UNSTABLE")
334334
ot_multi_option(OT_POWER_SUPPLY OT_POWER_SUPPLY_VALUES OPENTHREAD_CONFIG_DEVICE_POWER_SUPPLY OT_POWER_SUPPLY_ "set the device power supply config")
335335

336+
ot_int_option(OT_LOG_MAX_SIZE OPENTHREAD_CONFIG_LOG_MAX_SIZE "set maximum log string size")
336337
ot_int_option(OT_MAC_CSL_REQUEST_AHEAD_US OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US "set time ahead to deliver CSL frame from MAC to SubMac in microseconds")
337338
ot_int_option(OT_MLE_MAX_CHILDREN OPENTHREAD_CONFIG_MLE_MAX_CHILDREN "set maximum number of children")
338339
ot_int_option(OT_RCP_RESTORATION_MAX_COUNT OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT "set max RCP restoration count")

examples/platforms/simulation/logging.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat
101101

102102
if (sLogFile == NULL)
103103
{
104-
char logString[512];
104+
char logString[12 /* NodeId */ + OPENTHREAD_CONFIG_LOG_MAX_SIZE];
105105
int offset;
106106

107107
offset = snprintf(logString, sizeof(logString), "[%lu]", (unsigned long)gNodeId);

examples/platforms/utils/logging_rtt.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ extern "C" {
9393
* stack.
9494
*/
9595
#ifndef LOG_PARSE_BUFFER_SIZE
96-
#define LOG_PARSE_BUFFER_SIZE 128
96+
#define LOG_PARSE_BUFFER_SIZE \
97+
(19 /* Timestamp */ + 8 /* RTT color code */ + OPENTHREAD_CONFIG_LOG_MAX_SIZE + 1 /* \n */)
9798
#endif
9899

99100
/**

0 commit comments

Comments
 (0)