Example #1
0
 internal static void Cleanup()
 {
     if (_logWriter != null)
     {
         try
         {
             _logWriter.Flush();
             _logWriter.Close();
         }
         catch (Exception)
         {
         }
         _logWriter = null;
     }
     if (_newReader != null)
     {
         Console.SetIn(_oldConsoleIn);
         _oldConsoleIn = null;
         _newReader    = null;
     }
     if (_newWriter != null)
     {
         Console.SetOut(_oldConsoleOut);
         _oldConsoleOut = null;
         _newWriter     = null;
     }
 }
Example #2
0
 private static void EnsureRedirectOutputStream()
 {
     if (_oldConsoleOut == null)
     {
         _oldConsoleOut = Console.Out;
         _newWriter     = new LoggingTextWriter();
         _newWriter.AddTextWriter("STDOUT", Console.Out, true);
         Console.SetOut(_newWriter);
     }
 }