Closed AlexanderKot closed 6 months ago
Hi @AlexanderKot
looks intresting. Could you prepare a PR with that feature?
Hello I will provide one soon. Currently for this case exists workaround.
internal sealed class LogFactoryOptionsProvider : DefaultOptionsProvider
{
public override bool IsMatch(EndPoint endpoint)
=> true;
public override Microsoft.Extensions.Logging.ILoggerFactory LoggerFactory
=> IocContainer.Get<Microsoft.Extensions.Logging.ILoggerFactory>();
}
..... //As it is not possible to pass LoggerFactory thorough StackExchange.Redis.Extensions RedisConfiguration //it is workaround pass it via DefaultOptionsProvider which will override default one. //TODO: In case of adopting to Azure - probably need to switch base class for LogFactoryOptionsProvider DefaultOptionsProvider.AddProvider(new LogFactoryOptionsProvider());
At the same time it is also not possible to pass SocketManager.SocketManagerOptions throw RedisConnectionPoolManager, and for this there is no workaround.
New feature released in 2.7.4 ILogger support It cannot be used with Redis.Extensions because it must be provided for ConnectionMultiplexer.Connect(options) options.LoggerFactory = ....... ConnectionMultiplexer.Connect happens inside RedisConnectionPoolManager and it de-serialize options from RedisConfiguration. RedisConfiguration or create from props.
For de-serialization of options ConfigurationOptions.Parse() used (StackExchange.Redis codebase), but also it can be created from individual properties (Extensions codebase). In both cases it is not possible path LoggerFactory to ConnectionMultiplexer.
Also RedisConnectionPoolManager takse ILogger as constructor parameter for own usage. Seems it is possible to take LoggerFactory instead and pass it to multiplexer.