LogHelper.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using log4net;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using TeamAAS_VP.Resources.Languages;
  8. namespace TeamAAS_VP
  9. {
  10. public static class LogHelper
  11. {
  12. public static readonly ILog loginfo = LogManager.GetLogger("loginfo");
  13. public static readonly ILog logerror = LogManager.GetLogger("logerror");
  14. public static readonly ILog logdebug = LogManager.GetLogger("logdebug");
  15. public static readonly ILog logwarn = LogManager.GetLogger("logwarn");
  16. public static readonly ILog logfatal = LogManager.GetLogger("logfatal");
  17. public static readonly ILog logDynamic = LogManager.GetLogger("logDynamic");
  18. public static readonly ILog logCT = LogManager.GetLogger("logCT");
  19. public static readonly ILog logmes = LogManager.GetLogger("logMes");
  20. public static void WriteLogInfo(string info)
  21. {
  22. if (loginfo.IsInfoEnabled)
  23. {
  24. loginfo.Info(info);
  25. }
  26. }
  27. public static void WriteLogDebug(string info)
  28. {
  29. if (logdebug.IsDebugEnabled)
  30. {
  31. logdebug.Debug(info);
  32. }
  33. }
  34. public static void WriteLogPlcWarn(string info)
  35. {
  36. if (logwarn.IsWarnEnabled)
  37. {
  38. logwarn.Warn(info);
  39. }
  40. }
  41. public static void WriteLogError(string info, Exception se)
  42. {
  43. if (logerror.IsErrorEnabled)
  44. {
  45. logerror.Error(info, se);
  46. }
  47. }
  48. public static void WriteLogFatal(string info, Exception se)
  49. {
  50. if (logfatal.IsFatalEnabled)
  51. {
  52. logfatal.Fatal(info, se);
  53. }
  54. }
  55. public static void WriteOther(string info)
  56. {
  57. if (logDynamic.IsInfoEnabled)
  58. {
  59. logDynamic.Info(info);
  60. }
  61. }
  62. public static void WriteLogCT(string info)
  63. {
  64. if (logCT.IsInfoEnabled)
  65. {
  66. logCT.Info(info);
  67. }
  68. }
  69. public static void WriteLogMes(string info)
  70. {
  71. if (logmes.IsInfoEnabled)
  72. {
  73. logmes.Info(info);
  74. }
  75. }
  76. internal static void WriteLogError(Lang lang, double v, object 点校准界面加载时出错, Exception ex)
  77. {
  78. throw new NotImplementedException();
  79. }
  80. }
  81. }