Make logging optional in all public APIs (#72)
This commit is contained in:
parent
2c852f0757
commit
729c8b5eb9
1 changed files with 36 additions and 13 deletions
|
|
@ -4,6 +4,7 @@ using McpDotNet.Configuration;
|
|||
using McpDotNet.Logging;
|
||||
using McpDotNet.Protocol.Transport;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
namespace McpDotNet.Client;
|
||||
/// <summary>
|
||||
|
|
@ -43,10 +44,22 @@ public class McpClientFactory : IDisposable
|
|||
public McpClientFactory(
|
||||
IEnumerable<McpServerConfig> serverConfigs,
|
||||
McpClientOptions clientOptions,
|
||||
ILoggerFactory loggerFactory,
|
||||
ILoggerFactory? loggerFactory = null,
|
||||
Func<McpServerConfig, IClientTransport>? transportFactoryMethod = null,
|
||||
Func<IClientTransport, McpServerConfig, McpClientOptions, IMcpClient>? clientFactoryMethod = null)
|
||||
{
|
||||
if (serverConfigs is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(serverConfigs));
|
||||
}
|
||||
|
||||
if (clientOptions is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(clientOptions));
|
||||
}
|
||||
|
||||
loggerFactory ??= NullLoggerFactory.Instance;
|
||||
|
||||
_serverConfigs = serverConfigs.ToDictionary(c => c.Id);
|
||||
_clientOptions = clientOptions;
|
||||
_loggerFactory = loggerFactory;
|
||||
|
|
|
|||
Loading…
Reference in a new issue