3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
C# 專業 LOG FILE(DEBUG LOG FILE) 記錄檔案 創建/寫入/關閉 函數備份           //–         public static bool g_blnDebug = false;         public static StreamWriter g_sw;         public static void createLogFile()         {             if (g_blnDebug == true)             {                 g_sw = new StreamWriter(Application.StartupPath + “\\” + DateTime.Now.ToString(“yyyy-MM-dd-HHmm”) + “.log”);                 writeLogFile(“createLogFile”);             }         }         public static void writeLogFile(String msg)         {             if (g_blnDebug == true)             {                 g_sw.WriteLine(msg + “,\t” + DateTime.Now.ToString(“yyyy/MM/dd/HH:mm:ss”));             }         }         public static void closeLogFile()         {             if (g_blnDebug == true)             {                 writeLogFile(“closeLogFile”);                 g_sw.Close();// 關閉串流             }         }         //–

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦