-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
42 lines (27 loc) · 954 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Microsoft.AspNetCore.HttpLogging;
using AndreZammit.Tracing;
TracingProvider.Init(Directory.GetCurrentDirectory(), "QuickXorHash");
var builder = WebApplication.CreateBuilder(args);
var httpLoggingFields = HttpLoggingFields.All;
httpLoggingFields &= ~HttpLoggingFields.ResponseBody;
builder.Services.AddHttpLogging(logging =>
{
logging.RequestBodyLogLimit = 4096;
logging.ResponseBodyLogLimit = 4096;
logging.LoggingFields = httpLoggingFields;
logging.RequestHeaders.Add("X-Request-Header");
logging.ResponseHeaders.Add("X-Response-Header");
});
builder.Services.AddControllers().AddNewtonsoftJson();
builder.Services.AddSingleton<IConfiguration>(builder.Configuration);
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
}
app.UseFileServer();
app.UseHttpLogging();
app.UseRouting();
app.MapControllers();
app.Run();