You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
855 B
24 lines
855 B
7 days ago
|
using CoreAgent.Infrastructure.Middleware;
|
||
|
using CoreAgent.Infrastructure.Options;
|
||
|
using Microsoft.AspNetCore.Builder;
|
||
|
using Microsoft.Extensions.Configuration;
|
||
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
|
||
|
namespace CoreAgent.Infrastructure.Extensions
|
||
|
{
|
||
|
public static class RequestLoggingExtensions
|
||
|
{
|
||
|
public static IServiceCollection AddRequestLogging(this IServiceCollection services, IConfiguration config)
|
||
|
{
|
||
|
services.Configure<RequestLoggingOptions>(config.GetSection("RequestLogging"));
|
||
|
return services;
|
||
|
}
|
||
|
|
||
|
public static IApplicationBuilder UseRequestLogging(this IApplicationBuilder app, IConfiguration config)
|
||
|
{
|
||
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
||
|
app.UseMiddleware<ResponseLoggingMiddleware>();
|
||
|
return app;
|
||
|
}
|
||
|
}
|
||
|
}
|