Przeglądaj źródła

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

龙腾猫跃 5 miesięcy temu
rodzic
commit
347a51f9d4
1 zmienionych plików z 1 dodań i 0 usunięć
  1. 1 0
      Shared/General/Logger.cs

+ 1 - 0
Shared/General/Logger.cs

@@ -213,6 +213,7 @@ public class BaseLogger {
     /// </summary>
     /// </summary>
     public virtual string Format(string text, LogLevel level, string filePath, Exception? ex) {
     public virtual string Format(string text, LogLevel level, string filePath, Exception? ex) {
         string prefix = GetLogPrefix(level, filePath);
         string prefix = GetLogPrefix(level, filePath);
+        if (string.IsNullOrEmpty(text)) return prefix;
         return text
         return text
             .ReplaceLineEndings("\n", mergeMultiple: true).Split(['\n'], StringSplitOptions.RemoveEmptyEntries)
             .ReplaceLineEndings("\n", mergeMultiple: true).Split(['\n'], StringSplitOptions.RemoveEmptyEntries)
             .Select(t => prefix + t)
             .Select(t => prefix + t)