错误日志


public void WriteFile(string strText, string textName)
{
  string time = DateTime.Now.ToString("yyyy-MM");
  textName = time + "\\" + textName;
  DirectoryInfo di = new DirectoryInfo(@"D:\日志\" + time);
  if (!di.Exists) { di.Create(); }
  StreamWriter writer = new StreamWriter(@"D:\日志\" + textName + ".txt", true);

  writer.WriteLine(strText);

  writer.Close();

}

posted on 2019-03-19 10:41  *tfe*  阅读(98)  评论(0)    收藏  举报

导航