一、直接写入文件

 /// <summary>
        /// 将message的内容写入日志文件
        /// </summary>
        /// <param name="msg"></param>
        public static void WriteLog(string msg)
        {
            string path = Application.StartupPath + "\\logFile";
            File.AppendAllText(path, string.Format("[{0}] : {1}{2}", DateTime.Now, msg, Environment.NewLine));
        }    
View Code

相关文章:

  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案