LogHelper.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 void WriteLogInfo(string info)
  20. {
  21. if (loginfo.IsInfoEnabled)
  22. {
  23. loginfo.Info(info);
  24. }
  25. }
  26. public static void WriteLogDebug(string info)
  27. {
  28. if (logdebug.IsDebugEnabled)
  29. {
  30. logdebug.Debug(info);
  31. }
  32. }
  33. public static void WriteLogWarn(string info)
  34. {
  35. if (logwarn.IsWarnEnabled)
  36. {
  37. logwarn.Warn(info);
  38. }
  39. }
  40. public static void WriteLogError(string info, Exception se)
  41. {
  42. if (logerror.IsErrorEnabled)
  43. {
  44. logerror.Error(info, se);
  45. }
  46. }
  47. public static void WriteLogFatal(string info, Exception se)
  48. {
  49. if (logfatal.IsFatalEnabled)
  50. {
  51. logfatal.Fatal(info, se);
  52. }
  53. }
  54. public static void WriteOther(string info)
  55. {
  56. if (logDynamic.IsInfoEnabled)
  57. {
  58. logDynamic.Info(info);
  59. }
  60. }
  61. public static void WriteLogCT(string info)
  62. {
  63. if (logCT.IsInfoEnabled)
  64. {
  65. logCT.Info(info);
  66. }
  67. }
  68. internal static void WriteLogError(Lang lang, double v, object 点校准界面加载时出错, Exception ex)
  69. {
  70. throw new NotImplementedException();
  71. }
  72. }
  73. }