标签:app append try ati var ring cto environ dal
public class LogClass
{
public void Write(string content)
{
try
{
var directoryPath = System.Windows.Forms.Application.StartupPath;
var filePath = directoryPath + "\\" + DateTime.Now.ToString("yyyy-MM-dd") + "a.log";
File.AppendAllText(filePath, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
File.AppendAllText(filePath, Environment.NewLine);
File.AppendAllText(filePath, content);
File.AppendAllText(filePath, Environment.NewLine);
}
catch (Exception ex)
{
Console.Write(ex.ToString());
}
}
}
标签:app append try ati var ring cto environ dal
原文地址:http://www.cnblogs.com/Cpart/p/6992344.html