/// cmd指令:tree /f >list.txt
/// 目录结构
///└─Log
/// └─20220408
/// test1.log
/// <summary>
/// 保存日志
/// </summary>
/// <param name="info">信息内容</param>
/// <param name="str">文件名</param>
public static void WriteLog(string info, string str)
{
string logDateDirPath = @"./Log/" + DateTime.Now.ToString("yyyyMMdd");
string logFileName = logDateDirPath + "\\" + str + ".log"; ;
if (!Directory.Exists(logDateDirPath))
{
Directory.CreateDirectory(logDateDirPath);
}
try
{
TextWriter tw = new StreamWriter(logFileName, true, System.Text.Encoding.Default); ;
tw.WriteLine(info);
tw.Close();
}
catch (Exception ex)
{
}
}