From eb3c5bf67fc088887bfd8a1a1581c10149a974db Mon Sep 17 00:00:00 2001 From: 14278/caihao <572156462@qq.com> Date: Tue, 23 Jan 2024 10:52:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91autoloader?= =?UTF-8?q?=20=E6=A8=A1=E6=9D=BF=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SRC/MESAgent/AutoLoaderLib/AutoLoaderLib_C.csproj | 4 ++++ SRC/MESAgent/AutoLoaderLib/clsAutoLoaderLibrary.cs | 2 +- SRC/MESAgent/AutoLoaderLib/modWIN.cs | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/SRC/MESAgent/AutoLoaderLib/AutoLoaderLib_C.csproj b/SRC/MESAgent/AutoLoaderLib/AutoLoaderLib_C.csproj index 5f76bc4..589129c 100644 --- a/SRC/MESAgent/AutoLoaderLib/AutoLoaderLib_C.csproj +++ b/SRC/MESAgent/AutoLoaderLib/AutoLoaderLib_C.csproj @@ -121,6 +121,10 @@ False ..\..\MES_S_DLL\iMESConst.dll + + False + ..\..\MES_S_DLL\iMESLog.dll + False diff --git a/SRC/MESAgent/AutoLoaderLib/clsAutoLoaderLibrary.cs b/SRC/MESAgent/AutoLoaderLib/clsAutoLoaderLibrary.cs index 3e6ef8b..a46c232 100644 --- a/SRC/MESAgent/AutoLoaderLib/clsAutoLoaderLibrary.cs +++ b/SRC/MESAgent/AutoLoaderLib/clsAutoLoaderLibrary.cs @@ -143,7 +143,7 @@ namespace AutoLoaderLib_C string strComponentNo = string.Empty; bool blnMoveFile = true; string strSQL = string.Empty; - + modWIN.WriteLog("开始读档:" + Path.GetFileName(FileName), iMESLog.iMESLogLevel.Trace); try { // //取出colParameter傳入參數 diff --git a/SRC/MESAgent/AutoLoaderLib/modWIN.cs b/SRC/MESAgent/AutoLoaderLib/modWIN.cs index cd62db0..b033a7f 100644 --- a/SRC/MESAgent/AutoLoaderLib/modWIN.cs +++ b/SRC/MESAgent/AutoLoaderLib/modWIN.cs @@ -6,6 +6,7 @@ using System.Runtime.InteropServices; using Microsoft.VisualBasic; using Microsoft.VisualBasic.CompilerServices; using static iMESCore.Base.iMESConst; +using System.Diagnostics; namespace AutoLoaderLib_C { @@ -487,6 +488,15 @@ namespace AutoLoaderLib_C return GetExceptionStackRet; } + public static void WriteLog(string msg, iMESLog.iMESLogLevel level, Exception e = null) + { + string MethodInfo = ""; + var ss = new StackTrace(true); + var mb = ss.GetFrame(1).GetMethod(); + MethodInfo = mb.DeclaringType.Namespace + "." + mb.DeclaringType.Name + "." + mb.Name; + var log = new iMESLog.MESLog(mb.DeclaringType.Namespace); + log.WriteLog(msg, level, e, MethodInfo); + } } } \ No newline at end of file