/[RomCheater]/trunk/RomCheater.Logging/logger.cs
ViewVC logotype

Diff of /trunk/RomCheater.Logging/logger.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater.Logging/logger.cs	2012/06/05 10:26:49	291
+++ trunk/RomCheater.Logging/logger.cs	2012/06/05 13:27:40	302
@@ -4,6 +4,7 @@
 using System.Text;
 using System.Reflection;
 using System.Windows.Forms;
+using System.IO;
 
 namespace RomCheater.Logging
 {
@@ -331,27 +332,29 @@
         }
         private void WriteToLog(string format, bool newline, params object[] args)
         {
+            TextWriter tw = TextWriter.Synchronized(writer.Log);
             if (writer != null)
             {
                 if (newline)
                 {
                     if (args.Length == 0)
                     {
-                        writer.Log.WriteLine(format.Replace("{", "{{").Replace("}", "}}"), args);
+                        tw.WriteLine(format.Replace("{", "{{").Replace("}", "}}"), args);
                         return;
                     }
-                    writer.Log.WriteLine(format, args);
+                    tw.WriteLine(format, args);
                 }
                 else
                 {
                     if (args.Length == 0)
                     {
-                        writer.Log.Write(format.Replace("{", "{{").Replace("}", "}}"), args);
+                        tw.Write(format.Replace("{", "{{").Replace("}", "}}"), args);
                         return;
                     }
-                    writer.Log.Write(format, args);
+                    tw.Write(format, args);
                 }
             }
+            tw.Flush();
         }
         #endregion
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22