/// <summary>
/// 写日志
/// </summary>
/// <param name="Descript"></param>
public static void WriteLog(string Descript)
{
try
{
//日志
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs\\");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
DateTime danow = DateTime.Now;
string FullFilePath = Path.Combine(path, danow.ToString("yyyy-MM-dd_HH") + "_log.txt");
StringBuilder str = new StringBuilder();
str.Append(danow.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-->");
str.Append(Descript);
StreamWriter sw;
if (File.Exists(FullFilePath))
{
sw = File.AppendText(FullFilePath);
}
else
{
sw = File.CreateText(FullFilePath);
}
sw.WriteLine(str.ToString());
sw.Close();
}
catch { }
}