public void LogMessage (string msg) { string sFilePath = Environment.CurrentDirectory + "Log_" + System.AppDomain.CurrentDomain.FriendlyName + ".txt"; System.IO.StreamWriter sw = System.IO.File.AppendText(sFilePath); try { string logLine = System.String.Format( "{0:G}: {1}.", System.DateTime.Now, msg); sw.WriteLine(logLine); } finally { sw.Close(); } }
LogMessage("Problem with program");
Last Updated on October 26, 2015