WJC
2019-12-30 f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs
@@ -42,6 +42,18 @@
        /// <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:普通Log,-1:致命错误Log</param>
        /// <param name="strLog">Log内容</param>
        public void WriteLog(int div, string strLog)
@@ -54,15 +66,21 @@
                    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;
                }
            }
        }