Skip to content

Commit

Permalink
updated serilog
Browse files Browse the repository at this point in the history
  • Loading branch information
HaikAsatryan committed Sep 10, 2024
1 parent d5f4bf7 commit a3b88e9
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Pandatech.CleanArchitecture.Core.Extensions;
using Pandatech.CleanArchitecture.Infrastructure.Helpers;
using Serilog;
using Serilog.Configuration;
using Serilog.Events;

namespace Pandatech.CleanArchitecture.Infrastructure.Extensions;
Expand Down Expand Up @@ -38,31 +39,35 @@ private static LoggerConfiguration ConfigureEnvironmentSpecificSettings(this Log
{
if (builder.Environment.IsLocal())
{
loggerConfig.WriteTo.Console();
loggerConfig
.WriteTo
.Console();
}
else if (builder.Environment.IsDevelopment())
{
loggerConfig
.WriteTo
.Console()
.WriteTo
.File(new EcsTextFormatter(),
builder.GetLogsPath(),
rollingInterval: RollingInterval.Day,
shared: true);
.File(builder);
}
else
{
loggerConfig
.WriteTo
.File(new EcsTextFormatter(),
builder.GetLogsPath(),
rollingInterval: RollingInterval.Day,
shared: true);
.File(builder);
}

return loggerConfig;
}

private static void File(this LoggerSinkConfiguration loggerConfig, WebApplicationBuilder builder)
{
loggerConfig
.File(new EcsTextFormatter(),
builder.GetLogsPath(),
rollingInterval: RollingInterval.Day);
}

private static LoggerConfiguration FilterOutUnwantedLogs(this LoggerConfiguration loggerConfig)
{
Expand Down

0 comments on commit a3b88e9

Please sign in to comment.