This commit is contained in:
owenchen committed 2026-11-06 16:14:51 +08:00
1 parent bcf82d0f45
commit 8260c417e2
7 files changed
+1148 -44

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
using System.Diagnostics;
namespace WinFormsApp3
{
/// <summary>
/// 截图预览诊断日志:exe 目录下 preview_debug.log。
/// 挂起类问题光看界面定位不到,必须把每一步(含线程号)落到磁盘上。
/// </summary>
public static class PreviewLog
{
private static readonly object Gate = new();
private static readonly string FilePath = Path.Combine(AppContext.BaseDirectory, "preview_debug.log");
public static void Write(string message)
{
string line = $"{DateTime.Now:HH:mm:ss.fff} [T{Thread.CurrentThread.ManagedThreadId:D2}] {message}";
try
{
lock (Gate) File.AppendAllText(FilePath, line + Environment.NewLine);
}
catch
{
// 日志写失败不影响功能
}
}
}
}