public void Log(string msg)
{
FileInfo file = new FileInfo("C:\\ErrorLog.txt");
if (!file.Exists)
{
file.Create();
}
StreamWriter stream = file.AppendText();
stream.WriteLine("DateTime:" + DateTime.Now.ToString());
stream.WriteLine(msg);
stream.Close();
}