Should logging infrastructure be injected when using IoC/DI if logging facade is used?

前端 未结 5 482
栀梦
栀梦 2021-02-02 07:30

I am using Autofac as my IoC and from everything I have read on topic of DI teaches to use \"constructor injection\" to explicitly expose class dependencies... However, I am als

5条回答
  •  -上瘾入骨i
    2021-02-02 07:56

    I personally think it's overkill.

    Logging should ideally have a very low overhead, so a single static logger instance per class seems like a better solution. Keeping the overhead low promotes the use of debug-level logging for instrumentation.

提交回复
热议问题