title: Simple MultiThread Safe Log Class
body: <p>What is the best approach to creating a simple multithread safe logging class?  Is something like this sufficient?  How would I purge the log when it's initially created?</p>
  
  <pre><code>public class Logging
  {
      public Logging()
      {
      }
  
      public void WriteToLog(string message)
      {
          object locker = new object();
  
          lock(locker)
          {
              StreamWriter SW;
              SW=File.AppendText("Data\\Log.txt");
              SW.WriteLine(message);
              SW.Close();
          }
      }
  }
  
  public partial class MainWindow : Window
  {
      public static MainWindow Instance { get; private set; }
      public Logging Log { get; set; }
  
      public MainWindow()
      {
          Instance = this;
          Log = new Logging();
      }
  }
  </code></pre>