From 9d61367c1fd278f58f721d4c0e69999f89e4485d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 12 十二月 2019 14:14:30 +0800
Subject: [PATCH] 添加最新绑定机制
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs | 42 ++++++++++++++++++++++++++++++------------
1 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
old mode 100755
new mode 100644
index 3f2e723..bccf1e7
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
@@ -42,27 +42,45 @@
/// <summary>
/// Log鍑哄姏
/// </summary>
+ /// <param name="ex"></param>
+ public void WriteLog(Exception ex)
+ {
+ //Log鍑哄姏
+ string msg = ex.Message + "\r\n";
+ msg += ex.StackTrace;
+ this.WriteLog(-1, msg);
+ }
+
+ /// <summary>
+ /// Log鍑哄姏
+ /// </summary>
/// <param name="div">1:鏅�歀og,-1:鑷村懡閿欒Log</param>
/// <param name="strLog">Log鍐呭</param>
public void WriteLog(int div, string strLog)
{
lock (objLock)
{
- if (div != -1)
+ if (div != -1 && UserCenterResourse.HideOption.DetailedLog == 0)
{
//鏆傛椂鍙褰曞紓甯镐俊鎭�
return;
}
//Log鏂囦欢
- string fileName = this.GetLogFile(div);
- string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory, fileName);
-
- strLog = "[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog;
- strLog = UserCenterLogic.EncryptPassword("1|Oli]7p", strLog);
- var sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8);
- sw.WriteLine(strLog);
- sw.Close();
- sw = null;
+ 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";
+ sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8);
+ sw.WriteLine(strLog);
+ }
+ catch { }
+ finally
+ {
+ sw?.Close();
+ sw = null;
+ }
}
}
@@ -77,11 +95,11 @@
string fileName = DateTime.Now.ToString("yyyyMMdd");
if (div == -1)
{
- fileName += "Log";
+ fileName += "Error";
}
else if (div == 1)
{
- fileName += "Error";
+ fileName += "Log";
}
fileName = UserCenterLogic.EncryptPassword("4^Olh_3f", fileName);
return fileName;
--
Gitblit v1.8.0