LogHelper.cs 759 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Threading;
  6. using Library;
  7. using LitJson;
  8. using MySystem;
  9. public class LogHelper
  10. {
  11. public readonly static LogHelper Instance = new LogHelper();
  12. private LogHelper()
  13. { }
  14. public void WriteLog(string Content, string FileName, bool sls = false)
  15. {
  16. if(sls)
  17. {
  18. Dictionary<string, string> dic = new Dictionary<string, string>();
  19. dic.Add("Topic", FileName);
  20. dic.Add("Content", Content);
  21. KxsRedisDbconn.Instance.AddList("SlsLogQueue", Newtonsoft.Json.JsonConvert.SerializeObject(dic));
  22. }
  23. else
  24. {
  25. function.WriteLog(Content, FileName);
  26. }
  27. }
  28. }