From 61a99208f1af4b469bab2a685ada7041154d6c0c Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Thu, 26 Sep 2024 20:28:21 +0330 Subject: [PATCH] style: :lipstick: fix code formatting --- .../DependencyInjectionExtensions.cs | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs b/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs index 92a7499..a28c4a1 100644 --- a/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs +++ b/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs @@ -41,7 +41,8 @@ public static WebApplicationBuilder AddCustomSerilog( // https://github.com/serilog/serilog-settings-configuration loggerConfiguration.ReadFrom.Configuration( builder.Configuration, - new ConfigurationReaderOptions {SectionName = nameof(SerilogOptions)}); + new ConfigurationReaderOptions { SectionName = nameof(SerilogOptions) } + ); extraConfigure?.Invoke(loggerConfiguration); @@ -56,16 +57,16 @@ public static WebApplicationBuilder AddCustomSerilog( .Enrich.WithExceptionDetails( new DestructuringOptionsBuilder() .WithDefaultDestructurers() - .WithDestructurers(new[] {new DbUpdateExceptionDestructurer()})); - + .WithDestructurers(new[] { new DbUpdateExceptionDestructurer() }) + ); if (serilogOptions.UseConsole) { // https://github.com/serilog/serilog-sinks-async // https://github.com/lucadecamillis/serilog-sinks-spectre - loggerConfiguration.WriteTo.Async( - writeTo => - writeTo.Spectre(outputTemplate: serilogOptions.LogTemplate)); + loggerConfiguration.WriteTo.Async(writeTo => + writeTo.Spectre(outputTemplate: serilogOptions.LogTemplate) + ); } // https://github.com/serilog/serilog-sinks-async @@ -74,7 +75,7 @@ public static WebApplicationBuilder AddCustomSerilog( // elasticsearch sink internally is async // https://www.nuget.org/packages/Elastic.Serilog.Sinks loggerConfiguration.WriteTo.Elasticsearch( - new[] {new Uri(serilogOptions.ElasticSearchUrl),}, + new[] { new Uri(serilogOptions.ElasticSearchUrl) }, opts => { opts.DataStream = new DataStreamName( @@ -84,17 +85,17 @@ public static WebApplicationBuilder AddCustomSerilog( builder.Environment.EnvironmentName }-{ DateTime.Now - :yyyy-MM}"); + :yyyy-MM}" + ); opts.BootstrapMethod = BootstrapMethod.Failure; opts.ConfigureChannel = channelOpts => - { - channelOpts.BufferOptions = - new BufferOptions - {ExportMaxConcurrency = 10}; - }; - }); + { + channelOpts.BufferOptions = new BufferOptions { ExportMaxConcurrency = 10 }; + }; + } + ); } // https://github.com/serilog-contrib/serilog-sinks-grafana-loki @@ -104,9 +105,10 @@ public static WebApplicationBuilder AddCustomSerilog( serilogOptions.GrafanaLokiUrl, new[] { - new LokiLabel {Key = "service", Value = "food-delivery"}, + new LokiLabel { Key = "service", Value = "food-delivery" }, }, - ["app"]); + ["app"] + ); } if (!string.IsNullOrEmpty(serilogOptions.SeqUrl)) @@ -124,15 +126,17 @@ public static WebApplicationBuilder AddCustomSerilog( if (!string.IsNullOrEmpty(serilogOptions.LogPath)) { - loggerConfiguration.WriteTo.Async( - writeTo => - writeTo.File( - serilogOptions.LogPath, - outputTemplate: serilogOptions.LogTemplate, - rollingInterval: RollingInterval.Day, - rollOnFileSizeLimit: true)); + loggerConfiguration.WriteTo.Async(writeTo => + writeTo.File( + serilogOptions.LogPath, + outputTemplate: serilogOptions.LogTemplate, + rollingInterval: RollingInterval.Day, + rollOnFileSizeLimit: true + ) + ); } - }); + } + ); return builder; }