forked from modelcontextprotocol/csharp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMcpLoggerProvider.cs
30 lines (28 loc) · 918 Bytes
/
McpLoggerProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using ModelContextProtocol.Server;
using System;
using System.Collections.Concurrent;
namespace ModelContextProtocol.Logging
{
/// <summary>
/// Provides logging over MCP's notifications to send log messages to the client
/// </summary>
/// <param name="mcpServer">MCP Server.</param>
public class McpLoggerProvider(IMcpServer mcpServer) : ILoggerProvider
{
/// <summary>
/// Creates a new instance of an MCP logger
/// </summary>
/// <param name="categoryName">Logger Category Name</param>
/// <returns>New Logger instance</returns>
public ILogger CreateLogger(string categoryName)
=> new McpLogger(categoryName, mcpServer);
/// <summary>
/// Dispose
/// </summary>
public void Dispose()
{
}
}
}