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

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

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

--- trunk/EmuXPortal/Logging/logger.cs	2012/08/22 02:12:46	104
+++ trunk/EmuXPortal/Logging/logger.cs	2012/08/22 02:36:47	105
@@ -35,6 +35,8 @@
                 FileAccess access = FileAccess.ReadWrite;
                 if (new FileInfo(log_file_path).Exists) { mode = FileMode.Append; access = FileAccess.Write; }
                 using (FileStream fs = new FileStream(log_file_path, mode, access, FileShare.ReadWrite)) { Write(fs, format, args); }
+                format = null;
+                args = null;
             }
             public void Write(Stream s, string format, params object[] args)
             {
@@ -44,6 +46,8 @@
                     Log_Write(sw, format, args);
                     sw.Close();
                 }
+                format = null;
+                args = null;
             }
             public void WriteLine(string format, params object[] args)
             {
@@ -51,6 +55,8 @@
                 FileAccess access = FileAccess.ReadWrite;
                 if (new FileInfo(log_file_path).Exists) { mode = FileMode.Append; access = FileAccess.Write; }
                 using (FileStream fs = new FileStream(log_file_path, mode, access, FileShare.ReadWrite)) { WriteLine(fs, format, args); }
+                format = null;
+                args = null;
             }
             public void WriteLine(Stream s, string format, params object[] args)
             {
@@ -58,8 +64,12 @@
                 {
                     sw.AutoFlush = true;
                     Log_WriteLine(sw, format, args);
+                    format = null;
+                    args = null;
                     sw.Close();
-                }
+                }               
+                s.Dispose();
+                s = null;
             }
 
             private string GenerateTimestamp()
@@ -73,16 +83,28 @@
             private void Log_Write(StreamWriter sw, string format, params object[] args)
             {
                 string formatted_string = string.Format(format, args);
-                string t = string.Format("{0}{1}", GenerateTimestamp(), formatted_string);
+                string timestamp = GenerateTimestamp();
+                string t = string.Format("{0}{1}", timestamp, formatted_string);
+                timestamp = null;
                 sw.Write(t);
                 Console.Write(t);
+                formatted_string = null;
+                t = null;
+                format = null;
+                args = null;
             }
             private void Log_WriteLine(StreamWriter sw, string format, params object[] args)
             {
                 string formatted_string = string.Format(format, args);
-                string t = string.Format("{0}{1}", GenerateTimestamp(), formatted_string);
+                string timestamp = GenerateTimestamp();
+                string t = string.Format("{0}{1}", timestamp, formatted_string);
+                timestamp = null;
                 sw.WriteLine(t);
                 Console.WriteLine(t);
+                formatted_string = null;
+                t = null;
+                format = null;
+                args = null;
             }
             #endregion
         }

 

  ViewVC Help
Powered by ViewVC 1.1.22