发布时间:2020-07-17编辑:admin阅读(1231)
public void fileLog(string log) { try { if (log != "") { string currentpath = System.Reflection.Assembly.GetExecutingAssembly().Location; string[] name = currentpath.Split('\\'); string path = ""; for (int i = 0; i < name.Length - 1; i++) { path += name[i] + @"\"; } FileStream fs = new FileStream(path + "log.txt", FileMode.OpenOrCreate); StreamWriter sw = new StreamWriter(fs); //设定书写的开始位置为文件的末尾 fs.Position = fs.Length; sw.WriteLine(DateTime.Now.ToString() + " 日志:" + log); sw.Close(); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
下一篇:卸载Skype
0人
0人
0人
0人