Many of my classes are accepting some ILogger
interface.
This interface is implemented by a class that can accept the context it should log.
So in practice when passing ILogger
, what I want to pass is new Logger(nameof(<type>)
, depending on the <type>
we are currently resolving.
Can this be done in some sort in Autofac without specifically stating the contructor parameters for each type? since this is always the behavior I want to achieve when Autofac resolves ILogger
injection parameter.
Found a formal example in
Autofac
documentation:http://docs.autofac.org/en/latest/examples/log4net.html