错误日志


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();

}

原文地址:https://www.cnblogs.com/tfeblog/p/10557068.html