From f3e65daca7978b21b5888f49b1bf35e1a6e5d4fd Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 13 七月 2020 12:33:31 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
index f1b5642..21fed47 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
@@ -43,10 +43,12 @@
         /// Log鍑哄姏
         /// </summary>
         /// <param name="ex"></param>
-        public void WriteLog(Exception ex)
+        /// <param name="appendMsg">闄勫姞娑堟伅</param>
+        public void WriteLog(Exception ex, string appendMsg = "")
         {
             //Log鍑哄姏
-            string msg = ex.Message + "\r\n";
+            string msg = appendMsg == "" ? string.Empty : appendMsg + "\r\n";
+            msg += ex.Message + "\r\n";
             msg += ex.StackTrace;
             this.WriteLog(-1, msg);
         }
@@ -54,13 +56,13 @@
         /// <summary>
         /// Log鍑哄姏
         /// </summary>
-        /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log</param>
+        /// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log,2,3:鐗规畩Log</param>
         /// <param name="strLog">Log鍐呭</param>
         public void WriteLog(int div, string strLog)
         {
             lock (objLock)
             {
-                if (div != -1 && UserCenterResourse.HideOption.DetailedLog == 0)
+                if (div == 1 && UserCenterResourse.HideOption.DetailedLog == 0)
                 {
                     //鏆傛椂鍙褰曞紓甯镐俊鎭�
                     return;
@@ -69,9 +71,21 @@
                 System.IO.StreamWriter sw = null;
                 try
                 {
-                    string fileName = this.GetLogFile(div);
-                    string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory, fileName);
-                    strLog = "[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog + "\r\n";
+                    string fullName = string.Empty;
+                    if (div == 1 || div == -1)
+                    {
+                        string fileName = this.GetLogFile(div);
+                        fullName = System.IO.Path.Combine(DirNameResourse.LogDirectory, fileName);
+                    }
+                    else if (div == 2)
+                    {
+                        fullName = DirNameResourse.SendAndReceveDataLog;
+                    }
+                    else if (div == 3)
+                    {
+                        fullName = DirNameResourse.SocketReceiveDataLog;
+                    }
+                    strLog = "\r\n[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog + "\r\n";
                     sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8);
                     sw.WriteLine(strLog);
                 }
@@ -92,7 +106,7 @@
         private string GetLogFile(int div)
         {
             //鍔犲瘑,鍥犱负杩欐槸鏀堕泦鏁版嵁,鏈�濂戒笉璁╁埆浜虹煡閬撹繖鏄粈涔堟渶濂�
-            string fileName = DateTime.Now.ToString("yyyyMMdd");
+            string fileName = UserCenterResourse.UserInfo.Account + "-" + DateTime.Now.ToString("yyyyMMdd");
             if (div == -1)
             {
                 fileName += "Error";

--
Gitblit v1.8.0