mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(logging): ✨ add Serilog Request logging
This commit is contained in:
parent
c3562e7747
commit
fe84b49c1d
7 changed files with 23 additions and 2 deletions
|
|
@ -23,9 +23,9 @@ public void ConfigureServices(IServiceCollection services)
|
|||
|
||||
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseApplication();
|
||||
if (env.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseApplication();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,7 @@ public static void AddInfrastructureServices(this IServiceCollection services, I
|
|||
|
||||
public static void UseInfrastructure(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseLogging();
|
||||
app.UseScheduling();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public void ConfigureServices(IServiceCollection services)
|
|||
|
||||
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseApplication();
|
||||
if (env.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseRouting();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using AutoMapper;
|
||||
using FilterLists.Directory.Infrastructure;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
|
@ -20,5 +21,10 @@ public static void AddApplicationServices(this IServiceCollection services, ICon
|
|||
services.AddAutoMapper(typeof(ConfigurationExtensions));
|
||||
services.AddInfrastructureServices(configuration);
|
||||
}
|
||||
|
||||
public static void UseApplication(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseInfrastructure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
|
||||
using FilterLists.SharedKernel.Logging;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -23,5 +24,10 @@ public static void AddInfrastructureServices(this IServiceCollection services, I
|
|||
});
|
||||
services.AddScoped<IQueryContext, QueryContext>();
|
||||
}
|
||||
|
||||
public static void UseInfrastructure(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseLogging();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ internal static class Configuration
|
|||
public static LoggerConfiguration LoggerConfiguration = new LoggerConfiguration()
|
||||
.MinimumLevel.Debug()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
.MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Console();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
|
||||
namespace FilterLists.SharedKernel.Logging
|
||||
|
|
@ -9,5 +10,10 @@ public static IHostBuilder UseLogging(this IHostBuilder hostBuilder)
|
|||
{
|
||||
return hostBuilder.UseSerilog();
|
||||
}
|
||||
|
||||
public static void UseLogging(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseSerilogRequestLogging();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue