C#创建日志方法
2021-03-08 19:27
标签:src splay opened time writer class public utf8 click C#创建日志方法 标签:src splay opened time writer class public utf8 click 原文地址:https://www.cnblogs.com/alannever/p/12782011.html 1 public void WriteLog(string log)
2 {
3 StreamWriter stream;
4 string path = "D:/WriteLog/";
5 if (!Directory.Exists(path))
6 {
7 Directory.CreateDirectory(path);
8 }
9 stream = new StreamWriter(path + "AddVideo.txt", true, Encoding.UTF8);
10 stream.WriteLine(DateTime.Now.ToString() + ":" + log);
11 stream.Flush();
12 stream.Close();
13 }