forked from Kieran/void.cat
Add HttpLogging
This commit is contained in:
parent
29cd0c20d8
commit
dbfde5c70e
@ -1,6 +1,7 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using Microsoft.AspNetCore.HttpLogging;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -49,6 +50,12 @@ if (useRedis)
|
|||||||
services.AddSingleton(cx.GetDatabase());
|
services.AddSingleton(cx.GetDatabase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
services.AddHttpLogging((o) =>
|
||||||
|
{
|
||||||
|
o.LoggingFields = HttpLoggingFields.All;
|
||||||
|
o.RequestBodyLogLimit = 4096;
|
||||||
|
o.ResponseBodyLogLimit = 4096;
|
||||||
|
});
|
||||||
services.AddHttpClient();
|
services.AddHttpClient();
|
||||||
services.AddSwaggerGen(c =>
|
services.AddSwaggerGen(c =>
|
||||||
{
|
{
|
||||||
@ -164,6 +171,7 @@ foreach (var migration in migrations)
|
|||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
app.UseHttpLogging();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
Loading…
Reference in New Issue
Block a user