Skip to content

Commit

Permalink
added RemoveAllLoggers
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Jul 1, 2024
1 parent 74ef64b commit a567b14
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Console.Advanced/Console.Advanced.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Telegram.Bot" Version="21.3.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Console.Advanced/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// More read:
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-5.0#typed-clients
// https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests
services.AddHttpClient("telegram_bot_client")
services.AddHttpClient("telegram_bot_client").RemoveAllLoggers()
.AddTypedClient<ITelegramBotClient>((httpClient, sp) =>
{
BotConfiguration? botConfig = sp.GetConfiguration<BotConfiguration>();
Expand Down
2 changes: 1 addition & 1 deletion Webhook.MinimalAPIs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var webhookUrl = builder.Configuration.GetValue("BotWebhookUrl", "{set your bot webhook url in appsettings.json")!;

builder.Services.ConfigureTelegramBot<Microsoft.AspNetCore.Http.Json.JsonOptions>(opt => opt.SerializerOptions);
builder.Services.AddHttpClient("tgwebhook").AddTypedClient(httpClient => new TelegramBotClient(token, httpClient));
builder.Services.AddHttpClient("tgwebhook").RemoveAllLoggers().AddTypedClient(httpClient => new TelegramBotClient(token, httpClient));
var app = builder.Build();
app.UseHttpsRedirection();

Expand Down

0 comments on commit a567b14

Please sign in to comment.