C# Log檔案紀錄類別(檔案接續寫入)
class FileLog
{
public static void WriteLog(string logMessage,string FilePath,bool run)
{
if (run)
{
TextWriter w = File.AppendText(FilePath);
w.WriteLine(“{0}/{1} :{2}”, DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString(), logMessage);
w.Close();
}
}
}