Guest User

Untitled

a guest
Aug 14th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1.     class Log
  2.     {
  3.         private static StreamWriter _fileOut;
  4.         static Boolean LogToConsole = true;
  5.         static Boolean LogToFile = true;
  6.  
  7.         static Log()
  8.         {
  9.             if (LogToFile)
  10.             {
  11.                 _fileOut = File.CreateText("Program_out.txt");
  12.                 _fileOut.AutoFlush = true;
  13.             }
  14.         }
  15.  
  16.         public static void WriteLine(string format, params object[] arg)
  17.         {
  18.             if (LogToConsole)
  19.                 Console.WriteLine(format, arg);
  20.             if (LogToFile)
  21.                 _fileOut.WriteLine(format, arg);
  22.         }
  23.     }
Add Comment
Please, Sign In to add comment