From b000ae9e41b8699d1c7d6eefa0441ee05c970d25 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 13 Mar 2025 19:43:56 +0800 Subject: fix: NONEWLINE more explicit fixes a problem where all of socket wrote response is using NONE fmt(944b18bde52778b32c31dc23f3d90fc17b94794f) so all of them don't have \n --- src/format.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/format.hpp') diff --git a/src/format.hpp b/src/format.hpp index 42a4458..dd210c0 100644 --- a/src/format.hpp +++ b/src/format.hpp @@ -9,6 +9,7 @@ enum eFormatType : int8_t { WARN, ERR, SYS, + NONEWLINE }; namespace NFormatter { @@ -34,8 +35,10 @@ inline std::string fmt(eFormatType type, std::string str) { prefix = ""; break; } - if (!str.empty() && str.back() != '\n' && !prefix.empty()) + + if (str.back() != '\n' && type != NONEWLINE) str += '\n'; + return prefix + str; } -- cgit v1.2.3