ASP.Net Log File Function

So this is just as much for me as anyone reading this. This is a quick little function that will detect if a log file has written for the current day. If one doesn’t exist then it will create one, if it does exist then it will timestamp and append the log message to the file.

public static void writeToLogFile(string logMessage)
	string sYear    = DateTime.Now.Year.ToString();
	string sMonth    = DateTime.Now.Month.ToString();
	string sDay    = DateTime.Now.Day.ToString();
	string sTime = sYear+"-"+sMonth+"-"+sDay;
	string strLogMessage = string.Empty;
	string strLogFile = @"c:low-balance-logs" + sTime + ".txt";
	StreamWriter swLog;
	strLogMessage = string.Format("{0}: {1}", DateTime.Now, logMessage);
	if (!File.Exists(strLogFile))
		var dir = new DirectoryInfo(@"c:low-balance-logs");
		var file = new FileInfo(Path.Combine(dir.FullName, sTime + ".txt"));
		using (Stream stream = file.OpenWrite())
		swLog = new StreamWriter(strLogFile);
		swLog = File.AppendText(strLogFile);