From 32e832a898a6466369669717e7b11f7c957371bb Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期四, 25 十二月 2025 09:49:17 +0800
Subject: [PATCH] 修复log显示以及文件大小问题。

---
 LB_SmartVision/VisionForm.cs |   70 +++++++++++++++++++++++------------
 1 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/LB_SmartVision/VisionForm.cs b/LB_SmartVision/VisionForm.cs
index 343d396..971f1cb 100644
--- a/LB_SmartVision/VisionForm.cs
+++ b/LB_SmartVision/VisionForm.cs
@@ -242,7 +242,7 @@
             {
                 return;
             }
-            string strInfo = DateTime.Now.ToString("[yyyy:MM:HH:mm:ss:fff] ");
+            string strInfo = DateTime.Now.ToString("[yyyy:MM:dd:HH:mm:ss:fff] ");
             strInfo += strLog;
             if (infoType != LogInfoType.NOSHOW)
             {
@@ -258,19 +258,30 @@
                         switch (infoType)
                         {
                             case LogInfoType.INFO:
-                                this.rich_Info.SelectionColor = Color.Wheat;
-                                break;
+                                {
+                                    this.rich_Info.SelectionColor = Color.Wheat;
+                                    AsyncLogHelper.Info(strLog);
+                                    break;
+                                }
                             case LogInfoType.WARN:
-                                this.rich_Info.SelectionColor = Color.LightGoldenrodYellow;
-                                break;
+                                {
+                                    this.rich_Info.SelectionColor = Color.Yellow;
+                                    AsyncLogHelper.Warn(strLog);
+                                    break;
+                                }
                             case LogInfoType.PASS:
-                                this.rich_Info.SelectionColor = Color.Green;
-                                break;
+                                {
+                                    this.rich_Info.SelectionColor = Color.Green;
+                                    AsyncLogHelper.Info(strLog);
+                                    break;
+                                }
                             case LogInfoType.ERROR:
-                                this.rich_Info.SelectionColor = Color.Red;
-                                break;
+                                {
+                                    this.rich_Info.SelectionColor = Color.Red;
+                                    AsyncLogHelper.Error(strLog);
+                                    break;
+                                }
                         }
-
                         // 鏇存柊 UI 鎺т欢锛屾瘮濡傛樉绀烘帴鏀跺埌鐨勬秷鎭�
                         this.rich_Info.AppendText(strInfo);
                         this.rich_Info.AppendText("\r\n");
@@ -282,32 +293,43 @@
                 {
 
                     if (this.rich_Info.Lines.Length > 1000)
+                    {
                         this.rich_Info.Clear();
-
+                    }
                     // 濡傛灉宸茬粡鍦� UI 绾跨▼涓婏紝鐩存帴鏇存柊 UI
                     switch (infoType)
                     {
                         case LogInfoType.INFO:
-                            this.rich_Info.SelectionColor = Color.Wheat;
-                            break;
+                            {
+                                this.rich_Info.SelectionColor = Color.Wheat;
+                                AsyncLogHelper.Info(strLog);
+                                break;
+                            }
                         case LogInfoType.WARN:
-                            this.rich_Info.SelectionColor = Color.Yellow;
-                            break;
+                            {
+                                this.rich_Info.SelectionColor = Color.Yellow;
+                                AsyncLogHelper.Warn(strLog);
+                                break;
+                            }
                         case LogInfoType.PASS:
-                            this.rich_Info.SelectionColor = Color.Green;
-                            break;
+                            {
+                                this.rich_Info.SelectionColor = Color.Green;
+                                AsyncLogHelper.Info(strLog);
+                                break;
+                            }
                         case LogInfoType.ERROR:
-                            this.rich_Info.SelectionColor = Color.Red;
-                            break;
+                            {
+                                this.rich_Info.SelectionColor = Color.Red;
+                                AsyncLogHelper.Error(strLog);
+                                break;
+                            }
                     }
-
                     this.rich_Info.AppendText(strInfo);
                     this.rich_Info.AppendText("\r\n");
                     this.rich_Info.SelectionStart = this.rich_Info.Text.Length;
                     this.rich_Info.ScrollToCaret();
                 }
             }
-            AsyncLogHelper.Info(strLog);
         }
 
         public static bool SaveAllLayout()
@@ -502,9 +524,9 @@
         {
             XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));
             string[] paths = {
-            @"鐢熶骇鏃ュ織\Run_Log",
-            @"鐢熶骇鏃ュ織\Debug_Log",
-            @"鐢熶骇鏃ュ織\Error_Log",
+            @"鐢熶骇鏃ュ織\Run",
+            @"鐢熶骇鏃ュ織\Debug",
+            @"鐢熶骇鏃ュ織\Error",
             @"鐢熶骇鏃ュ織\Fatal",
             @"鐢熶骇鏃ュ織\Warn",
             };

--
Gitblit v1.9.3