LogHelper.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. namespace TeamAAS_VP
  8. {
  9. public static class LogHelper
  10. {
  11. public static readonly ILog loginfo = LogManager.GetLogger("loginfo");
  12. public static readonly ILog logerror = LogManager.GetLogger("logerror");
  13. public static readonly ILog logdebug = LogManager.GetLogger("logdebug");
  14. public static readonly ILog logwarn = LogManager.GetLogger("logwarn");
  15. public static readonly ILog logfatal = LogManager.GetLogger("logfatal");
  16. public static readonly ILog logDynamic = LogManager.GetLogger("logDynamic");
  17. public static readonly ILog logCT = LogManager.GetLogger("logCT");
  18. public static void WriteLogInfo(string info)
  19. {
  20. if (loginfo.IsInfoEnabled)
  21. {
  22. loginfo.Info(info);
  23. }
  24. }
  25. public static void WriteLogDebug(string info)
  26. {
  27. if (logdebug.IsDebugEnabled)
  28. {
  29. logdebug.Debug(info);
  30. }
  31. }
  32. public static void WriteLogWarn(string info)
  33. {
  34. if (logwarn.IsWarnEnabled)
  35. {
  36. logwarn.Warn(info);
  37. }
  38. }
  39. public static void WriteLogError(string info, Exception se)
  40. {
  41. if (logerror.IsErrorEnabled)
  42. {
  43. logerror.Error(info, se);
  44. }
  45. }
  46. public static void WriteLogFatal(string info, Exception se)
  47. {
  48. if (logfatal.IsFatalEnabled)
  49. {
  50. logfatal.Fatal(info, se);
  51. }
  52. }
  53. public static void WriteOther(string info)
  54. {
  55. if (logDynamic.IsInfoEnabled)
  56. {
  57. logDynamic.Info(info);
  58. }
  59. }
  60. public static void WriteLogCT(string info)
  61. {
  62. if (logCT.IsInfoEnabled)
  63. {
  64. logCT.Info(info);
  65. }
  66. }
  67. }
  68. }