fix: 空日志行会缺失日志前缀

This commit is contained in:
龙腾猫跃 committed 2026-05-12 12:04:07 +08:00
1 parent a10ec00951
commit 347a51f9d4
1 file changed
+1
+1
View File
@@ -213,6 +213,7 @@ public class BaseLogger {
/// </summary>
public virtual string Format(string text, LogLevel level, string filePath, Exception? ex) {
string prefix = GetLogPrefix(level, filePath);
if (string.IsNullOrEmpty(text)) return prefix;
return text
.ReplaceLineEndings("\n", mergeMultiple: true).Split(['\n'], StringSplitOptions.RemoveEmptyEntries)
.Select(t => prefix + t)