ILog还是ILogger? [英] ILog or ILogger?
本文介绍了ILog还是ILogger?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我应该使用ILog还是ILogger接口?我发现ILog接口更易于使用,因为我可以通过调用每个类声明一个实例:
Should I be using the ILog or ILogger interface? I find the ILog interface to be easier to use since I can just declare one instance per class by calling:
private ILog _logger = LogManager.GetLogger(typeof(MyClass));
与ILogger相比,它是一个简单得多的界面:
It's a much simpler interface then the ILogger:
void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception)
有区别吗?什么时候使用1相对于其他更好?
Is there a difference? When is it better to use 1 vs the other?
推荐答案
我建议使用ILog
接口.这已由Apache/Common Logging推送.如果您使用通用的日志记录界面,那么大多数日志记录系统都可以插入到您的应用程序中.
I recommend the ILog
interface. This has been pushed by Apache/Common Logging. If you use the common logging interface, then most logging systems can be plugged into your application.
我发现log4net绰绰有余.
I find log4net to be more than adequate.
这篇关于ILog还是ILogger?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文