Fork me on GitHub

2,EasyNetQ-日志记录

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()))

 

posted on 2017-07-13 16:51  *Hunter  阅读(808)  评论(0编辑  收藏  举报

导航

AmazingCounters.com