C#:写日志

mac2022-06-30  21

 

一、直接写入文件

/// <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

 

二、通过插件

 

转载于:https://www.cnblogs.com/shenchao/p/4761377.html

最新回复(0)