LogTool.cs 657 B

123456789101112131415161718192021
  1. using System;
  2. using Y.Utils.FileUtils;
  3. namespace Y.Utils.TxtUtils
  4. {
  5. class LogTool
  6. {
  7. public static void Normal(string tag, string info)
  8. {
  9. try
  10. {
  11. string today = DateTime.Now.ToString("yyyy-MM-dd");
  12. string logPath = AppDomain.CurrentDomain.BaseDirectory + "Log";
  13. string file = string.Format(@"{0}\{1}.txt", logPath, today);
  14. DirTool.Create(logPath);
  15. TxtTool.Append(file, string.Format("time:{0} tag:{1} info:{2}", DateTime.Now.ToString("HH:mm:ss"), tag, info));
  16. }
  17. catch (Exception e) { }
  18. }
  19. }
  20. }