From 47b2532da245422d8e881d51d5a4f086f7db3c51 Mon Sep 17 00:00:00 2001 From: rosahay-silabs Date: Thu, 9 Jun 2022 14:27:55 +0530 Subject: [PATCH] Adds tickcount to log messages --- src/platform/EFR32/Logging.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platform/EFR32/Logging.cpp b/src/platform/EFR32/Logging.cpp index ad78dfae0a033a..5adcba96238c07 100644 --- a/src/platform/EFR32/Logging.cpp +++ b/src/platform/EFR32/Logging.cpp @@ -133,10 +133,13 @@ extern "C" void efr32Log(const char * aFormat, ...) va_start(v, aFormat); #if EFR32_LOG_ENABLED + TickType_t now; char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; static_assert(sizeof(formattedMsg) > kMaxCategoryStrLen); // Greater than to at least accommodate a ending Null Character - strcpy(formattedMsg, LOG_EFR32); + // strcat(formattedMsg, LOG_EFR32); + now = xTaskGetTickCount(); + snprintf(formattedMsg, CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE, "[%ld] %s", now, LOG_EFR32); size_t prefixLen = strlen(formattedMsg); size_t len = vsnprintf(formattedMsg + prefixLen, sizeof formattedMsg - prefixLen, aFormat, v);