C# 簡單粗暴寫日誌

public static void WriteLog(string text)
{orm

string path = AppDomain.CurrentDomain.BaseDirectory;
path = System.IO.Path.Combine(path
, "Logs\\");string

if (!System.IO.Directory.Exists(path))
{
System.IO.Directory.CreateDirectory(path);
}
string fileFullName = System.IO.Path.Combine(path
, string.Format("{0}.txt", DateTime.Now.ToString("yyyyMMdd-HHmm")));it


using (StreamWriter output = System.IO.File.AppendText(fileFullName))
{
output.WriteLine(text);file

output.Close();
}
}im

相關文章
相關標籤/搜索