Which pattern to use for logging? Dependency Injection or Service Locator?

后端 未结 9 949
别那么骄傲
别那么骄傲 2021-01-31 15:51

Consider this scenario. I have some business logic that now and then will be required to write to a log.

interface ILogger
{
    void Log(string stuff);
}

inte         


        
9条回答
  •  离开以前
    2021-01-31 16:19

    I'd recommend neither of these approaches. Better to use aspect-oriented programming. Logging is the "hello world" of AOP.

提交回复
热议问题