EasyNetQ提供了一个IEasyNetQLogger接口:

public interface IEasyNetQLogger
{
   void DebugWrite(string format, params object[] args);
   void InfoWrite(string format, params object[] args);
   void ErrorWrite(string format, params object[] args);
   void ErrorWrite(Exception exception);
}

实现IEasyNetQLogger接口

        public class MyLogger : IEasyNetQLogger
        {
            public void DebugWrite(string format, params object[] args)
            {
            }

            public void ErrorWrite(Exception exception)
            {
            }

            public void ErrorWrite(string format, params object[] args)
            {
            }

            public void InfoWrite(string format, params object[] args)
            {
                Console.WriteLine(format, args);
            }
        }

使用日志记录

var bus = RabbitHutch.CreateBus("host=localhost", x => x.Register<IEasyNetQLogger>(_ => new MyLogger()))

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-05-17
  • 2021-12-07
  • 2022-01-20
  • 2021-04-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
相关资源
相似解决方案