| | |
| | | public class logg |
| | | { |
| | | //日志写法 |
| | | public static void WriteLog(string msg) |
| | | public static void WriteLog(string msg,string shenfgen="") |
| | | { |
| | | string filePath = AppDomain.CurrentDomain.BaseDirectory + "Log"; //路径 |
| | | if (!Directory.Exists(filePath)) //不存在则创建 |
| | | { |
| | | Directory.CreateDirectory(filePath); |
| | | } |
| | | string logPath = AppDomain.CurrentDomain.BaseDirectory + "Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; //文档路径 |
| | | string logPath = AppDomain.CurrentDomain.BaseDirectory + "Log\\" + shenfgen + DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; //文档路径 |
| | | try |
| | | { |
| | | using (StreamWriter sw = File.AppendText(logPath)) |