Skip to content

Instantly share code, notes, and snippets.

@stavrossk
Created February 19, 2013 21:42
Show Gist options
  • Save stavrossk/4990327 to your computer and use it in GitHub Desktop.
Save stavrossk/4990327 to your computer and use it in GitHub Desktop.
Debug logger: Write debug message to log file.
public class Debugger
{
public static void LogMessageToFile(string msg)
{
if ( !Settings.WriteDebugLog)
return;
System.IO.StreamWriter sw
= System.IO.File.
AppendText("Debug.log");
try
{
string logLine = String.Format(
"{0:G}: {1}", DateTime.Now, msg);
sw.WriteLine(logLine);
}
finally
{
sw.Close();
}
}
}//endof class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment