From 019b6bce12a34dfb8e0b92d77fb2f3dd9730c553 Mon Sep 17 00:00:00 2001 From: cfif Date: Wed, 11 Mar 2026 11:08:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inc/LoggerInterface.h | 11 +++++++++++ Src/LoggerPrintf.c | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Inc/LoggerInterface.h b/Inc/LoggerInterface.h index 5b24411..4a4e3b7 100644 --- a/Inc/LoggerInterface.h +++ b/Inc/LoggerInterface.h @@ -10,6 +10,10 @@ #include "stdint.h" #include "stdbool.h" +#define MAX_COUNT_BUF_LOG 10 +#define MAX_LEN_BUF_LOG 128 +#define MAX_LEN_BUF_NAME_LOG 16 + typedef enum { LOGLEVEL_FATAL, LOGLEVEL_ERROR, @@ -29,11 +33,18 @@ typedef void (*LoggerGenericMethod)( bool complete ); +typedef uint8_t * (*getMemPrintfBufLogMethod)( + void *env, + const char *authorStatic, + const uint8_t authorLen +); + extern tStringStatic LOGGER_LEVEL_NAMES[]; typedef struct { void *env; LoggerGenericMethod logging; + getMemPrintfBufLogMethod getMemPrintfBufLog; } tLoggerInterface; diff --git a/Src/LoggerPrintf.c b/Src/LoggerPrintf.c index bf68470..8e2e426 100644 --- a/Src/LoggerPrintf.c +++ b/Src/LoggerPrintf.c @@ -755,13 +755,14 @@ void LoggerPrintf( // // LoggerInfo(logger, "ss", "", 0); - char str[128]; + //char str[128]; + char *str = (char *) logger->getMemPrintfBufLog(logger->env, authorStatic, authorLen); int result; va_list args; va_start(args, fmt); - result = vsnprintf(str, sizeof(str), fmt, args); + result = vsnprintf(str, MAX_LEN_BUF_LOG, fmt, args); va_end(args);