move analytics to logging module; do only log httpclient warning+errors
This commit is contained in:
@@ -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
-1
@@ -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;
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user