Description
Currently, we sprinkle LogManager.GetCurrentClassLogger()
all over the code base and, thus, spread a direct dependency to NLog all over the solution. As was discussed in chat several times, we should probably take a nore structurised approach to this.
One concern in the past was that when deriving from a type GetCurrentClassLogger
in the base gets the logger with the message setup for the base class. However, this can be circumvented using LogManager.GetLogger(GetType()FullName)
.
Using this, I would like to suggest to introduce two abstract base classes for logging providing a protected logger, one generic and one not. The non-generic one will be used for classes at the top of an inheritance hierarchy and the generic one for derived class. The latter will derive from its generic parameter in order to circumvent the need for (illegal) multiple-inheritance. (I hope this is actually legal in C#.)