From df691c16f1e4ead7ac1a2d9a2b9665e1133d6c8f Mon Sep 17 00:00:00 2001 From: tqcq Date: Mon, 11 Dec 2023 13:28:40 +0800 Subject: [PATCH] fix --- src/ulib/log/logger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ulib/log/logger.cpp b/src/ulib/log/logger.cpp index 5b29295..f6f9040 100644 --- a/src/ulib/log/logger.cpp +++ b/src/ulib/log/logger.cpp @@ -28,7 +28,7 @@ Logger::Log(int32_t level, const char *file, const char *func, int32_t line, con std::string pattern = "[{}] {}:{}@{} msg: {}"; // auto add CR - bool need_append_line_break = !msg || msg[strlen(msg) - 1] != '\n'; + bool need_append_line_break = !msg || *msg == '\0' || msg[strlen(msg) - 1] != '\n'; if (need_append_line_break) { pattern.append(1, '\n'); }