Log4netHelper.cs 785 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace ivf_tl_Services
  7. {
  8. public class Log4netHelper
  9. {
  10. public static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
  11. public static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
  12. public static void WriteLog(string info)
  13. {
  14. if (loginfo.IsInfoEnabled)
  15. {
  16. loginfo.Info(info);
  17. }
  18. }
  19. public static void WriteLog(string info, Exception se)
  20. {
  21. if (logerror.IsErrorEnabled)
  22. {
  23. logerror.Error(info, se);
  24. }
  25. }
  26. }
  27. }