From ba51ea4cbb140c479514ae26b3bcfa576817b426 Mon Sep 17 00:00:00 2001 From: liuyifei Date: Tue, 23 Jul 2024 08:10:25 +0000 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BB=A5\n=E5=BC=80=E5=A4=B4?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=89=93=E5=8D=B0=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=8D=A2=E8=A1=8C=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuyifei --- frameworks/libhilog/utils/log_print.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/libhilog/utils/log_print.cpp b/frameworks/libhilog/utils/log_print.cpp index 3c7be48..37b3cb6 100644 --- a/frameworks/libhilog/utils/log_print.cpp +++ b/frameworks/libhilog/utils/log_print.cpp @@ -162,7 +162,8 @@ void LogPrintWithFormat(const LogContent& content, const LogFormat& format, std: const char *pHead = content.log; const char *pScan = content.log; - if (*pScan != '\0') { + // not print prefix if log is empty string or start with \n + if (*pScan != '\0' && *pScan != '\n') { PrintLogPrefix(content, format, out); } // split the log content by '\n', and add log prefix(datetime, pid, tid....) to each new line -- Gitee