File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 99 <PackageReference Include =" AspNetCore.HealthChecks.Uris" />
1010 </ItemGroup >
1111
12+ <ItemGroup >
13+ <Compile Include =" $(SharedDir)\LoggingUtils.cs" Link =" LoggingUtils.cs" />
14+ </ItemGroup >
15+
1216</Project >
Original file line number Diff line number Diff line change 11using Aspire . Hosting . ApplicationModel ;
2+ using CommunityToolkit . Hosting . Utils ;
23using Microsoft . Extensions . DependencyInjection ;
34
45namespace Aspire . Hosting ;
@@ -138,6 +139,7 @@ public static IResourceBuilder<McpInspectorResource> AddMcpInspector(this IDistr
138139 setup . AddCustomHeader ( "X-MCP-Proxy-Auth" , $ "Bearer { token } ") ;
139140 } ) ;
140141 } , healthCheckKey ) ;
142+ builder . Services . SuppressHealthCheckHttpClientLogging ( healthCheckKey ) ;
141143
142144 return resource . WithHealthCheck ( healthCheckKey ) ;
143145 }
Original file line number Diff line number Diff line change 1+ using Microsoft . Extensions . DependencyInjection ;
2+ using Microsoft . Extensions . Logging ;
3+
4+ namespace CommunityToolkit . Hosting . Utils ;
5+
6+ internal static class LoggingUtils
7+ {
8+ public static void SuppressHealthCheckHttpClientLogging ( this IServiceCollection services , string healthCheckName )
9+ {
10+ services . AddLogging ( configure =>
11+ {
12+ // The AddUrlGroup health check makes use of http client factory.
13+ configure . AddFilter ( $ "System.Net.Http.HttpClient.{ healthCheckName } .LogicalHandler", LogLevel . None ) ;
14+ configure . AddFilter ( $ "System.Net.Http.HttpClient.{ healthCheckName } .ClientHandler", LogLevel . None ) ;
15+ } ) ;
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments