Log.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace tool
  7. {
  8. public class Log:Singleton<Log>
  9. {
  10. private Log()
  11. {
  12. }
  13. public void LogInit()
  14. {
  15. LogManager.Instance.LogManagerInit();
  16. }
  17. /// <summary>
  18. /// 写文件类型
  19. /// </summary>
  20. /// <param name="logType"></param>
  21. /// <param name="logFile"></param>
  22. /// <param name="msg"></param>
  23. public void WriteLog(LogType logType, LogFile logFile, string msg)
  24. {
  25. try
  26. {
  27. LogManager.Instance.WriteLog(logType, logFile, msg);
  28. }
  29. catch
  30. {
  31. }
  32. }
  33. /// <summary>
  34. /// 文件类型为null
  35. /// </summary>
  36. /// <param name="logType"></param>
  37. /// <param name="msg"></param>
  38. public void WriteLog(LogType logType, string msg)
  39. {
  40. try
  41. {
  42. LogManager.Instance.WriteLog(logType, string.Empty, msg);
  43. }
  44. catch
  45. {
  46. }
  47. }
  48. /// <summary>
  49. /// 数据库异常的标志位
  50. /// 0表示update,1表示insert
  51. /// </summary>
  52. /// <param name="logType"></param>
  53. /// <param name="status"></param>
  54. /// <param name="msg"></param>
  55. public void WriteLog(LogType logType, string status, string msg)
  56. {
  57. try
  58. {
  59. LogManager.Instance.WriteLog(logType, status, msg);
  60. }
  61. catch
  62. {
  63. }
  64. }
  65. /// <summary>
  66. /// 读日志文件
  67. /// </summary>
  68. /// <param name="sqlStatus"></param>
  69. /// <param name="sqlMsg"></param>
  70. /// <param name="count"></param>
  71. public List<string> ReadLog()
  72. {
  73. List<string> digitList = null;
  74. try
  75. {
  76. digitList = LogManager.Instance.ReadLog();
  77. }
  78. catch { }
  79. return digitList;
  80. }
  81. public void WriteCredence(string msg)
  82. {
  83. try
  84. {
  85. LogManager.Instance.WriteCredence(msg);
  86. }
  87. catch { }
  88. }
  89. }
  90. }