using AyCode.Core.Loggers;
using AyCode.Services.SignalRs;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.Logging;
namespace FruitBankHybrid.Shared.Services.SignalRs;
///
/// FruitBank-specific hub-connection setup.
///
/// Connection-level configuration (URL, buffers, timeouts, reconnect) is delegated to the
/// framework's , driven by
/// from appsettings.json. The logger is supplied
/// by the caller (typically via a DI-registered Func<string, AcLoggerBase> factory
/// in Program.cs), keeping this extension free of LoggerClient construction.
///
///
public static class FruitBankHubConnectionExtensions
{
///
/// Applies with the given
/// , then bridges into
/// SignalR's internal ILogger pipeline.
///
public static IHubConnectionBuilder AddFruitBankDefaults(this IHubConnectionBuilder builder, AcLoggerBase logger, AcHubConnectionOptions connectionOptions)
{
return builder
.AddAcConnection(connectionOptions)
.ConfigureLogging(logging =>
{
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information);
logging.AddAcLogger(_ => logger);
});
}
}