Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SAPPub.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using SAPPub.Web.Middleware;
using SAPPub.Web.Models.Config;
using SAPSec.Web.Middleware;
using Serilog;
using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
Expand All @@ -25,6 +26,8 @@ public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);

builder.Host.UseSerilog((ctx, config) => config.ReadFrom.Configuration(ctx.Configuration));

builder.Services.Configure<AnalyticsOptions>(builder.Configuration.GetSection("Analytics"));

builder.Services.AddHttpClient<IPostcodeLookupService, PostcodeLookupService>();
Expand Down
3 changes: 3 additions & 0 deletions SAPPub.Web/SAPPub.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.23" />
<PackageReference Include="Npgsql" Version="10.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 14 additions & 0 deletions SAPPub.Web/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,19 @@
},
"ConnectionStrings": {
"PostgresConnectionString": "Host=localhost;Port=5432;Database=SAPData;Username=postgres;Password=postgres"
},
"DetailedErrors": true,
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft.AspNetCore": "Warning"
}
},
"WriteTo": [
{
"Name": "Console"
}
]
}
}
18 changes: 18 additions & 0 deletions SAPPub.Web/appsettings.Production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Serilog": {
"WriteTo": [
{
"Name": "Console",
"Args": {
"formatter": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact"
}
}
]
}
}
16 changes: 15 additions & 1 deletion SAPPub.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,19 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft.AspNetCore": "Warning"
}
},
"WriteTo": [
{
"Name": "Console"
}
],
"Enrich": [ "FromLogContext" ]
}
}
Loading