We will start this chapter by providing an overview of the different logging components of ASP.NET Core. The framework provides different interfaces that support logging:
- ILoggerProvider is used to define a specific type of logging bind with an output channel
- ILoggerFactory takes an ILoggerProvider interface and initializes it
- The ILogger interface is a particular instance of the logging component
The logging interface structure of ASP.NET Core can be described using the following schema:
In short, the ILoggerProvider interface represents the output of the logs, ILoggerFactory creates the right type of instance, and ILogger is the actual instance of the logger.
This kind of approach guarantees secure isolation between the ILogger interface consumer and the logging provider part. Furthermore, we may choose to add the calls to the ILogger interface in...