-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Centralise logging config over all apps (#940)
- Loading branch information
Showing
30 changed files
with
256 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
...achingRecordSystem.Api/Infrastructure/Logging/IgnoreSuppressedExceptionsLogEventFilter.cs
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
TeachingRecordSystem/src/TeachingRecordSystem.Api/Infrastructure/Logging/LogSuppressions.cs
This file was deleted.
Oops, something went wrong.
59 changes: 6 additions & 53 deletions
59
...em/src/TeachingRecordSystem.Api/Infrastructure/Logging/WebApplicationBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"DetailedErrors": true, | ||
"Platform": "Local", | ||
"Serilog": { | ||
"MinimumLevel": { | ||
"Default": "Information", | ||
|
1 change: 0 additions & 1 deletion
1
TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.Testing.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"Platform": "Local", | ||
"Serilog": { | ||
"MinimumLevel": { | ||
"Default": "Error", | ||
|
54 changes: 0 additions & 54 deletions
54
TeachingRecordSystem/src/TeachingRecordSystem.Core/SentryErrors.cs
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
TeachingRecordSystem/src/TeachingRecordSystem.Hosting/HostApplicationBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Serilog; | ||
using Serilog.Formatting.Compact; | ||
|
||
namespace TeachingRecordSystem.Hosting; | ||
|
||
public static class Extensions | ||
{ | ||
public static void ConfigureSerilog( | ||
this LoggerConfiguration config, | ||
IHostEnvironment environment, | ||
IConfiguration configuration, | ||
IServiceProvider services) | ||
{ | ||
config | ||
.ReadFrom.Configuration(configuration) | ||
.WriteTo.ApplicationInsights(services.GetRequiredService<TelemetryConfiguration>(), TelemetryConverter.Traces) | ||
.WriteTo.Sentry(o => o.InitializeSdk = false); | ||
|
||
if (environment.IsProduction()) | ||
{ | ||
config.WriteTo.Console(new CompactJsonFormatter()); | ||
} | ||
else | ||
{ | ||
config.WriteTo.Console(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
TeachingRecordSystem/src/TeachingRecordSystem.Hosting/TeachingRecordSystem.Hosting.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Hosting" /> | ||
<PackageReference Include="Sentry.Serilog" /> | ||
<PackageReference Include="Serilog.Formatting.Compact" /> | ||
<PackageReference Include="Serilog.Settings.Configuration" /> | ||
<PackageReference Include="Serilog.Sinks.ApplicationInsights" /> | ||
<PackageReference Include="Serilog.Sinks.Console" /> | ||
<PackageReference Include="SerilogTimings" /> | ||
</ItemGroup> | ||
|
||
</Project> |
2 changes: 1 addition & 1 deletion
2
TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.