Skip to content

Commit

Permalink
feat(log): limit to 10KB
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyupe committed Dec 3, 2024
1 parent 8fad1cd commit d43d785
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cafe.Matcha/Views/MainControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ private void Log(LogType type, char level, string message)
}

string typeString = Enum.GetName(typeof(LogType), type);
vm.Log = string.Format("[{0}][{1}][{2}] {3}\r\n", DateTime.Now, level, typeString, message) + vm.Log;
vm.Log = string.Format("[{0}][{1}][{2}] {3}\r\n", DateTime.Now, level, typeString, message) +
(vm.Log.Length > 10240 ? vm.Log.Substring(0, 10240) : vm.Log);
++vm.LogShowCount;
}

Expand Down

0 comments on commit d43d785

Please sign in to comment.