/// <summary> /// 写入日志 /// </summary> /// <param name="readme"></param> public void WriteLog(string readme) { string _Date = System.DateTime.Now.Date.ToString("yyyy-MM-dd"); StreamWriter dout = new StreamWriter(@"D:/wwwroot/test.com/logs/" + _Date + ".txt", true); dout.Write("事件:" + readme + " 操作时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss")); dout.Write(System.Environment.NewLine); //换行 dout.Close(); }