Logging as a decorator vs. Dependency Injection - what if I need to log inside the class?
问题 (I originally asked this question in this comment, but Mark Seemann asked me to create a new question instead.) I'm starting a new app (.NET Core, if that matters), and right now I'm trying to decide how exactly to do logging. The general consensus seems to be that logging is a cross-cutting concern, so the logger shouldn't be injected directly into the class that is supposed to log. Often, there's an example like the following class how not to do it: public class BadExample : IExample {