THupload-Oss
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace THUploadOss
  7. {
  8. internal class Logger
  9. {
  10. private static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
  11. private static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
  12. public static void WriteInfo(string info)
  13. {
  14. Console.WriteLine(info);
  15. if (loginfo.IsInfoEnabled)
  16. {
  17. loginfo.Info(info);
  18. }
  19. }
  20. public static void WriteError(string error)
  21. {
  22. Console.WriteLine(error);
  23. if (logerror.IsErrorEnabled)
  24. {
  25. logerror.Error(error);
  26. }
  27. }
  28. public static void WriteError(string info, Exception ex)
  29. {
  30. Console.WriteLine(info);
  31. if (logerror.IsErrorEnabled)
  32. {
  33. logerror.Error(info, ex);
  34. }
  35. }
  36. }
  37. }