Class LoggerWrapper<T>
- Namespace
- Arc4u.Diagnostics
- Assembly
- Arc4u.Diagnostics.dll
Transient implementation of ILoggerWrapper<T> that decorates the ILogger<TCategoryName> created by the ILoggerFactory.
The IAddPropertiesToLog it uses depends on where it is resolved: in a scope (an HTTP or gRPC request, a CreateScope()), the provider
registered under the key "Scoped", which may depend on scoped services; from the root (a singleton and its dependencies), the provider registered
under the key "Transient", which must not.
public sealed class LoggerWrapper<T> : LoggerBaseWrapper<T>, ILoggerWrapper<T>, ILogger<T>, ILogger, ILoggerCallerMember
Type Parameters
TThe category type of the logger.
- Inheritance
-
LoggerWrapper<T>
- Implements
-
ILogger<T>
- Inherited Members
- Extension Methods
Constructors
LoggerWrapper(ILoggerFactory, IServiceProvider, IOptionsMonitor<ApplicationConfig>)
Initializes a new instance of the LoggerWrapper<T> class.
public LoggerWrapper(ILoggerFactory loggerFactory, IServiceProvider serviceProvider, IOptionsMonitor<ApplicationConfig> appConfig)
Parameters
loggerFactoryILoggerFactoryThe factory used to create the underlying logger.
serviceProviderIServiceProviderThe provider the logger is resolved from, used to choose the
"Scoped"or"Transient"IAddPropertiesToLog.appConfigIOptionsMonitor<ApplicationConfig>The application configuration, used to obtain the application name.