简单的写文本日志方法
public void WriteGameLog(string msg,string logType) { //创建log文件夹 string log_path = @"C://log"; if (!Directory.Exists(log_path)) Directory.CreateDirectory(log_path); //创建log下分类文件夹 string gameLog_path = log_path + @"//" + logType; if (!Directory.Exists(gameLog_path)) Directory.CreateDirectory(gameLog_path); //按时间创建时间点文件 string path = gameLog_path + @"//" + DateTime.Now.ToString("yyyy_MM_dd") + ".txt"; File.AppendAllText(path, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + msg + Environment.NewLine); }