public static void WriteDataLog(String dateStr, String logText) { if (DataLogFileWriter != null) { DataLogFileWriter.Write(dateStr, logText); } }
public static void WriteToLog(string e) { DateTime timeEnd = DateTime.Now; DateTime timeBegin = DateTime.Now; StringBuilder logStr = new System.Text.StringBuilder(); logStr.Append("\r\n--->St:").Append(timeEnd.ToString("yyyy-MM-dd HH:mm:ss.fff")).Append(" Response error, ").Append(timeEnd.Subtract(timeBegin).Milliseconds).Append(" ms:"); logStr.Append("\r\n").Append(e); logStr.Append("\r\n--->Ed:").Append(e); DailyLogFileWriter DataLogFileWriter = null; string logPath = ConfigurationManager.AppSettings["WeChatLogPath"]; DataLogFileWriter = new DailyLogFileWriter(logPath, "LOG"); DataLogFileWriter.Write(timeBegin.ToString("yyyy-MM-dd"), logStr.ToString()); DataLogFileWriter.Close(); }