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()))
学习永不止境,技术成就梦想。