move analytics to logging module; do only log httpclient warning+errors

This commit is contained in:
2026-04-20 12:03:01 +02:00
parent 4b95b9281c
commit 8828fd96a2
6 changed files with 7 additions and 5 deletions
@@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
namespace Finch.Metadata;
namespace Finch.Logging;
[ApiController]
[Route("/api/hello")]
@@ -1,4 +1,4 @@
namespace Finch.Metadata;
namespace Finch.Logging;
public class AnalyticsOptions
{
@@ -1,4 +1,4 @@
using Finch.Metadata;
using Finch.Logging;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
+3
View File
@@ -11,6 +11,9 @@ public class FinchLoggingModule : FinchModule
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
services.AddHttpClient<AnalyticsController>();
services.AddOptions<AnalyticsOptions>().Bind(configuration.GetSection("Finch:Analytics"));
services.AddLogging(builder =>
{
// get seq configuration
+1
View File
@@ -23,6 +23,7 @@ public class LogLevelOverrides : Dictionary<string, LogLevel>
this["SixLabors"] = LogLevel.Warning;
this["Quartz"] = LogLevel.Warning;
this["Microsoft.AspNetCore"] = LogLevel.Warning;
this["System.Net.Http.HttpClient"] = LogLevel.Warning;
string executingAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
if (executingAssemblyName != null)
-2
View File
@@ -8,7 +8,5 @@ public class FinchMetadataModule : FinchModule
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
services.AddScoped<IMetadataService, MetadataService>();
services.AddHttpClient<AnalyticsController>();
services.AddOptions<AnalyticsOptions>().Bind(configuration.GetSection("Finch:Analytics"));
}
}