C#写一个简单的Log日志

来源:学生作业学帮网 编辑:学帮网 时间:2024/04/26 05:27:13

C#写一个简单的Log日志

StreamWriter log = new StreamWriter(LogPath + "ceshi.txt",true);
log.WriteLine("time:" + System.DateTime.Now.ToLongTimeString());
log.Close();
其中 LogPath 为日志存储地址,如:E:/,本例输出的是一个时间.