private void ReloadLoggerOptions(DatabaseLoggerOptions options) { this.options = options; foreach (var logger in _loggers.Values) { logger.settings = options; } }
public DatabaseLoggerProvider(IOptionsMonitor <DatabaseLoggerOptions> options, IExternalScopeProvider externalScopeProvider) { this.scopeProvider = externalScopeProvider ?? new LoggerExternalScopeProvider(); this.options = options?.CurrentValue ?? throw new InvalidOperationException(); memoryCache = new MemoryCache(new MemoryCacheOptions()); // Filter would be applied on LoggerFactory level optionsReloadToken = options.OnChange(ReloadLoggerOptions); ReloadLoggerOptions(options.CurrentValue); }