LogHelper.cs 757 B

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