Skip to content

Commit d2145f9

Browse files
fix(#19): this commit adds a condition that checks whether the environment is neither development nor production (i.e., another environment); if so, it does not log the SEQ and SENTRY
1 parent 3e69611 commit d2145f9

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Boundaries/Comanda.Payments/Source/Comanda.Payments.WebApi/Extensions/MonitoringExtension.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ public static class MonitoringExtension
44
{
55
public static void AddMonitoring(this WebApplicationBuilder builder)
66
{
7+
// prevents sentry from being initialized in non-production/non-development environments (e.g., testing)
8+
if (!builder.Environment.IsDevelopment() && !builder.Environment.IsProduction())
9+
return;
10+
711
var settings = builder.Services
812
.BuildServiceProvider()
913
.GetRequiredService<ISettings>();

Boundaries/Comanda.Payments/Source/Comanda.Payments.WebApi/Extensions/ObservabilityExtension.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ public static class ObservabilityExtension
55
{
66
public static void AddObservability(this WebApplicationBuilder builder)
77
{
8+
// prevents seq from being initialized in non-production/non-development environments (e.g., testing)
9+
if (!builder.Environment.IsDevelopment() && !builder.Environment.IsProduction())
10+
return;
11+
812
builder.Host.UseSerilog((context, services, logger) =>
913
{
1014
var settings = services.GetRequiredService<ISettings>();

0 commit comments

Comments
 (0)