Logger.cs 713 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace fis.Loader
  8. {
  9. internal class Logger
  10. {
  11. static string dir = AppDomain.CurrentDomain.BaseDirectory;
  12. static string logFile = Path.Combine(dir, "update.log");
  13. internal static void WriteLine(string logText)
  14. {
  15. if (!File.Exists(logFile))
  16. {
  17. File.WriteAllText(logFile,$"{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")} Fist time to create file");
  18. }
  19. File.AppendAllText(logFile, $"\r\n{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")} {logText}");
  20. }
  21. }
  22. }