Browse Source

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

龙腾猫跃 6 tháng trước cách đây
mục cha
commit
347a51f9d4
1 tập tin đã thay đổi với 1 bổ sung và 0 xóa
  1. 1 0
      Shared/General/Logger.cs

+ 1 - 0
Shared/General/Logger.cs

@@ -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)