From 013925360fde7bf949662a27931a297e0d6b0a48 Mon Sep 17 00:00:00 2001 From: Phong Nguyen Date: Thu, 25 Jul 2024 23:32:53 +0700 Subject: [PATCH] Configure LogLevel with Serilog --- .../Logging/LoggingExtensions.cs | 104 +++++++++--------- .../Logging/LoggingOptions.cs | 5 +- .../Logging/LoggingExtensions.cs | 104 +++++++++--------- .../Logging/LoggingOptions.cs | 5 +- .../appsettings.Development.json | 8 ++ .../Logging/LoggingExtensions.cs | 104 +++++++++--------- .../Logging/LoggingOptions.cs | 5 +- 7 files changed, 176 insertions(+), 159 deletions(-) diff --git a/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs b/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs index d6a26de91..fc9e9f837 100644 --- a/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs +++ b/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs @@ -11,13 +11,13 @@ using OpenTelemetry.Resources; using OpenTelemetry.Trace; using Serilog; +using Serilog.Events; using Serilog.Exceptions; using Serilog.Formatting.Json; using System; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Reflection; namespace ClassifiedAds.Infrastructure.Logging; @@ -32,8 +32,20 @@ private static void UseClassifiedAdsLogger(this IWebHostEnvironment env, Logging Directory.CreateDirectory(logsPath); var loggerConfiguration = new LoggerConfiguration(); + foreach (var logLevel in options.LogLevel) + { + var serilogLevel = ConvertToSerilogLevel(logLevel.Value); + + if (logLevel.Key == "Default") + { + loggerConfiguration.MinimumLevel.Is(serilogLevel); + continue; + } + + loggerConfiguration.MinimumLevel.Override(logLevel.Key, serilogLevel); + } + loggerConfiguration = loggerConfiguration - .MinimumLevel.Debug() .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() @@ -46,18 +58,7 @@ private static void UseClassifiedAdsLogger(this IWebHostEnvironment env, Logging .Enrich.WithExceptionDetails() .Filter.ByIncludingOnly((logEvent) => { - if (logEvent.Level >= options.File.MinimumLogEventLevel) - { - var sourceContext = logEvent.Properties.ContainsKey("SourceContext") - ? logEvent.Properties["SourceContext"].ToString() - : null; - - var logLevel = GetLogLevel(sourceContext, options); - - return logEvent.Level >= logLevel; - } - - return false; + return true; }) .WriteTo.File(Path.Combine(logsPath, "log.txt"), formatProvider: CultureInfo.InvariantCulture, @@ -90,37 +91,24 @@ private static LoggingOptions SetDefault(LoggingOptions options) { }; - options.LogLevel ??= new Dictionary(); + options.LogLevel ??= new Dictionary(); if (!options.LogLevel.ContainsKey("Default")) { - options.LogLevel["Default"] = "Warning"; + options.LogLevel["Default"] = LogLevel.Warning; } options.File ??= new LoggingOptions.FileOptions { - MinimumLogEventLevel = Serilog.Events.LogEventLevel.Warning, + MinimumLogEventLevel = LogEventLevel.Warning, }; options.EventLog ??= new LoggingOptions.EventLogOptions { IsEnabled = false, }; - return options; - } - - private static Serilog.Events.LogEventLevel GetLogLevel(string context, LoggingOptions options) - { - context = context.Replace("\"", string.Empty); - string level = "Default"; - var matches = options.LogLevel.Keys.Where(k => context.StartsWith(k, StringComparison.OrdinalIgnoreCase)); - if (matches.Any()) - { - level = matches.Max(); - } - - return (Serilog.Events.LogEventLevel)Enum.Parse(typeof(Serilog.Events.LogEventLevel), options.LogLevel[level], true); + return options; } public static IWebHostBuilder UseClassifiedAdsLogger(this IWebHostBuilder builder, Func logOptions) @@ -129,7 +117,6 @@ public static IWebHostBuilder UseClassifiedAdsLogger(this IWebHostBuilder builde { logging.Configure(options => { - // options.ActivityTrackingOptions = ActivityTrackingOptions.SpanId | ActivityTrackingOptions.TraceId | ActivityTrackingOptions.ParentId; }); logging.AddAzureWebAppDiagnostics(); @@ -195,7 +182,6 @@ public static IHostBuilder UseClassifiedAdsLogger(this IHostBuilder builder, Fun { logging.Configure(options => { - // options.ActivityTrackingOptions = ActivityTrackingOptions.SpanId | ActivityTrackingOptions.TraceId | ActivityTrackingOptions.ParentId; }); logging.AddAzureWebAppDiagnostics(); @@ -263,8 +249,20 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt Directory.CreateDirectory(logsPath); var loggerConfiguration = new LoggerConfiguration(); + foreach (var logLevel in options.LogLevel) + { + var serilogLevel = ConvertToSerilogLevel(logLevel.Value); + + if (logLevel.Key == "Default") + { + loggerConfiguration.MinimumLevel.Is(serilogLevel); + continue; + } + + loggerConfiguration.MinimumLevel.Override(logLevel.Key, serilogLevel); + } + loggerConfiguration = loggerConfiguration - .MinimumLevel.Debug() .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() @@ -276,18 +274,7 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt .Enrich.WithExceptionDetails() .Filter.ByIncludingOnly((logEvent) => { - if (logEvent.Level >= options.File.MinimumLogEventLevel) - { - var sourceContext = logEvent.Properties.ContainsKey("SourceContext") - ? logEvent.Properties["SourceContext"].ToString() - : null; - - var logLevel = GetLogLevel(sourceContext, options); - - return logEvent.Level >= logLevel; - } - - return false; + return true; }) .WriteTo.File(Path.Combine(logsPath, "log.txt"), formatProvider: CultureInfo.InvariantCulture, @@ -302,15 +289,30 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt { loggerConfiguration .WriteTo.AWSSeriLog(new AWSLoggerConfig(options.AwsCloudWatch.LogGroup) - { - LogStreamName = options.AwsCloudWatch.LogStreamNamePrefix, - Region = options.AwsCloudWatch.Region, - Credentials = new BasicAWSCredentials(options.AwsCloudWatch.AccessKey, options.AwsCloudWatch.SecretKey), - }, + { + LogStreamName = options.AwsCloudWatch.LogStreamNamePrefix, + Region = options.AwsCloudWatch.Region, + Credentials = new BasicAWSCredentials(options.AwsCloudWatch.AccessKey, options.AwsCloudWatch.SecretKey), + }, iFormatProvider: null, textFormatter: new JsonFormatter()); } Log.Logger = loggerConfiguration.CreateLogger(); } + + private static LogEventLevel ConvertToSerilogLevel(LogLevel logLevel) + { + return logLevel switch + { + LogLevel.Trace => LogEventLevel.Verbose, + LogLevel.Debug => LogEventLevel.Debug, + LogLevel.Information => LogEventLevel.Information, + LogLevel.Warning => LogEventLevel.Warning, + LogLevel.Error => LogEventLevel.Error, + LogLevel.Critical => LogEventLevel.Fatal, + LogLevel.None => LogEventLevel.Fatal, + _ => LogEventLevel.Fatal + }; + } } diff --git a/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs b/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs index ff490b065..f558555be 100644 --- a/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs +++ b/src/Microservices/Common/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs @@ -1,11 +1,12 @@ -using Serilog.Events; +using Microsoft.Extensions.Logging; +using Serilog.Events; using System.Collections.Generic; namespace ClassifiedAds.Infrastructure.Logging; public class LoggingOptions { - public Dictionary LogLevel { get; set; } + public Dictionary LogLevel { get; set; } public FileOptions File { get; set; } diff --git a/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs b/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs index d6a26de91..fc9e9f837 100644 --- a/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs +++ b/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs @@ -11,13 +11,13 @@ using OpenTelemetry.Resources; using OpenTelemetry.Trace; using Serilog; +using Serilog.Events; using Serilog.Exceptions; using Serilog.Formatting.Json; using System; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Reflection; namespace ClassifiedAds.Infrastructure.Logging; @@ -32,8 +32,20 @@ private static void UseClassifiedAdsLogger(this IWebHostEnvironment env, Logging Directory.CreateDirectory(logsPath); var loggerConfiguration = new LoggerConfiguration(); + foreach (var logLevel in options.LogLevel) + { + var serilogLevel = ConvertToSerilogLevel(logLevel.Value); + + if (logLevel.Key == "Default") + { + loggerConfiguration.MinimumLevel.Is(serilogLevel); + continue; + } + + loggerConfiguration.MinimumLevel.Override(logLevel.Key, serilogLevel); + } + loggerConfiguration = loggerConfiguration - .MinimumLevel.Debug() .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() @@ -46,18 +58,7 @@ private static void UseClassifiedAdsLogger(this IWebHostEnvironment env, Logging .Enrich.WithExceptionDetails() .Filter.ByIncludingOnly((logEvent) => { - if (logEvent.Level >= options.File.MinimumLogEventLevel) - { - var sourceContext = logEvent.Properties.ContainsKey("SourceContext") - ? logEvent.Properties["SourceContext"].ToString() - : null; - - var logLevel = GetLogLevel(sourceContext, options); - - return logEvent.Level >= logLevel; - } - - return false; + return true; }) .WriteTo.File(Path.Combine(logsPath, "log.txt"), formatProvider: CultureInfo.InvariantCulture, @@ -90,37 +91,24 @@ private static LoggingOptions SetDefault(LoggingOptions options) { }; - options.LogLevel ??= new Dictionary(); + options.LogLevel ??= new Dictionary(); if (!options.LogLevel.ContainsKey("Default")) { - options.LogLevel["Default"] = "Warning"; + options.LogLevel["Default"] = LogLevel.Warning; } options.File ??= new LoggingOptions.FileOptions { - MinimumLogEventLevel = Serilog.Events.LogEventLevel.Warning, + MinimumLogEventLevel = LogEventLevel.Warning, }; options.EventLog ??= new LoggingOptions.EventLogOptions { IsEnabled = false, }; - return options; - } - - private static Serilog.Events.LogEventLevel GetLogLevel(string context, LoggingOptions options) - { - context = context.Replace("\"", string.Empty); - string level = "Default"; - var matches = options.LogLevel.Keys.Where(k => context.StartsWith(k, StringComparison.OrdinalIgnoreCase)); - if (matches.Any()) - { - level = matches.Max(); - } - - return (Serilog.Events.LogEventLevel)Enum.Parse(typeof(Serilog.Events.LogEventLevel), options.LogLevel[level], true); + return options; } public static IWebHostBuilder UseClassifiedAdsLogger(this IWebHostBuilder builder, Func logOptions) @@ -129,7 +117,6 @@ public static IWebHostBuilder UseClassifiedAdsLogger(this IWebHostBuilder builde { logging.Configure(options => { - // options.ActivityTrackingOptions = ActivityTrackingOptions.SpanId | ActivityTrackingOptions.TraceId | ActivityTrackingOptions.ParentId; }); logging.AddAzureWebAppDiagnostics(); @@ -195,7 +182,6 @@ public static IHostBuilder UseClassifiedAdsLogger(this IHostBuilder builder, Fun { logging.Configure(options => { - // options.ActivityTrackingOptions = ActivityTrackingOptions.SpanId | ActivityTrackingOptions.TraceId | ActivityTrackingOptions.ParentId; }); logging.AddAzureWebAppDiagnostics(); @@ -263,8 +249,20 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt Directory.CreateDirectory(logsPath); var loggerConfiguration = new LoggerConfiguration(); + foreach (var logLevel in options.LogLevel) + { + var serilogLevel = ConvertToSerilogLevel(logLevel.Value); + + if (logLevel.Key == "Default") + { + loggerConfiguration.MinimumLevel.Is(serilogLevel); + continue; + } + + loggerConfiguration.MinimumLevel.Override(logLevel.Key, serilogLevel); + } + loggerConfiguration = loggerConfiguration - .MinimumLevel.Debug() .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() @@ -276,18 +274,7 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt .Enrich.WithExceptionDetails() .Filter.ByIncludingOnly((logEvent) => { - if (logEvent.Level >= options.File.MinimumLogEventLevel) - { - var sourceContext = logEvent.Properties.ContainsKey("SourceContext") - ? logEvent.Properties["SourceContext"].ToString() - : null; - - var logLevel = GetLogLevel(sourceContext, options); - - return logEvent.Level >= logLevel; - } - - return false; + return true; }) .WriteTo.File(Path.Combine(logsPath, "log.txt"), formatProvider: CultureInfo.InvariantCulture, @@ -302,15 +289,30 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt { loggerConfiguration .WriteTo.AWSSeriLog(new AWSLoggerConfig(options.AwsCloudWatch.LogGroup) - { - LogStreamName = options.AwsCloudWatch.LogStreamNamePrefix, - Region = options.AwsCloudWatch.Region, - Credentials = new BasicAWSCredentials(options.AwsCloudWatch.AccessKey, options.AwsCloudWatch.SecretKey), - }, + { + LogStreamName = options.AwsCloudWatch.LogStreamNamePrefix, + Region = options.AwsCloudWatch.Region, + Credentials = new BasicAWSCredentials(options.AwsCloudWatch.AccessKey, options.AwsCloudWatch.SecretKey), + }, iFormatProvider: null, textFormatter: new JsonFormatter()); } Log.Logger = loggerConfiguration.CreateLogger(); } + + private static LogEventLevel ConvertToSerilogLevel(LogLevel logLevel) + { + return logLevel switch + { + LogLevel.Trace => LogEventLevel.Verbose, + LogLevel.Debug => LogEventLevel.Debug, + LogLevel.Information => LogEventLevel.Information, + LogLevel.Warning => LogEventLevel.Warning, + LogLevel.Error => LogEventLevel.Error, + LogLevel.Critical => LogEventLevel.Fatal, + LogLevel.None => LogEventLevel.Fatal, + _ => LogEventLevel.Fatal + }; + } } diff --git a/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs b/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs index ff490b065..f558555be 100644 --- a/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs +++ b/src/ModularMonolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs @@ -1,11 +1,12 @@ -using Serilog.Events; +using Microsoft.Extensions.Logging; +using Serilog.Events; using System.Collections.Generic; namespace ClassifiedAds.Infrastructure.Logging; public class LoggingOptions { - public Dictionary LogLevel { get; set; } + public Dictionary LogLevel { get; set; } public FileOptions File { get; set; } diff --git a/src/Monolith/ClassifiedAds.BackgroundServer/appsettings.Development.json b/src/Monolith/ClassifiedAds.BackgroundServer/appsettings.Development.json index e203e9407..43cdfeb39 100644 --- a/src/Monolith/ClassifiedAds.BackgroundServer/appsettings.Development.json +++ b/src/Monolith/ClassifiedAds.BackgroundServer/appsettings.Development.json @@ -4,6 +4,14 @@ "Default": "Debug", "System": "Information", "Microsoft": "Information" + }, + "OpenTelemetry": { + "IsEnabled": true, + "ServiceName": "ClassifiedAds.BackgroundServer", + "Otlp": { + "IsEnabled": true, + "Endpoint": "https://localhost:21052" + } } } } diff --git a/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs b/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs index d6a26de91..fc9e9f837 100644 --- a/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs +++ b/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingExtensions.cs @@ -11,13 +11,13 @@ using OpenTelemetry.Resources; using OpenTelemetry.Trace; using Serilog; +using Serilog.Events; using Serilog.Exceptions; using Serilog.Formatting.Json; using System; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Reflection; namespace ClassifiedAds.Infrastructure.Logging; @@ -32,8 +32,20 @@ private static void UseClassifiedAdsLogger(this IWebHostEnvironment env, Logging Directory.CreateDirectory(logsPath); var loggerConfiguration = new LoggerConfiguration(); + foreach (var logLevel in options.LogLevel) + { + var serilogLevel = ConvertToSerilogLevel(logLevel.Value); + + if (logLevel.Key == "Default") + { + loggerConfiguration.MinimumLevel.Is(serilogLevel); + continue; + } + + loggerConfiguration.MinimumLevel.Override(logLevel.Key, serilogLevel); + } + loggerConfiguration = loggerConfiguration - .MinimumLevel.Debug() .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() @@ -46,18 +58,7 @@ private static void UseClassifiedAdsLogger(this IWebHostEnvironment env, Logging .Enrich.WithExceptionDetails() .Filter.ByIncludingOnly((logEvent) => { - if (logEvent.Level >= options.File.MinimumLogEventLevel) - { - var sourceContext = logEvent.Properties.ContainsKey("SourceContext") - ? logEvent.Properties["SourceContext"].ToString() - : null; - - var logLevel = GetLogLevel(sourceContext, options); - - return logEvent.Level >= logLevel; - } - - return false; + return true; }) .WriteTo.File(Path.Combine(logsPath, "log.txt"), formatProvider: CultureInfo.InvariantCulture, @@ -90,37 +91,24 @@ private static LoggingOptions SetDefault(LoggingOptions options) { }; - options.LogLevel ??= new Dictionary(); + options.LogLevel ??= new Dictionary(); if (!options.LogLevel.ContainsKey("Default")) { - options.LogLevel["Default"] = "Warning"; + options.LogLevel["Default"] = LogLevel.Warning; } options.File ??= new LoggingOptions.FileOptions { - MinimumLogEventLevel = Serilog.Events.LogEventLevel.Warning, + MinimumLogEventLevel = LogEventLevel.Warning, }; options.EventLog ??= new LoggingOptions.EventLogOptions { IsEnabled = false, }; - return options; - } - - private static Serilog.Events.LogEventLevel GetLogLevel(string context, LoggingOptions options) - { - context = context.Replace("\"", string.Empty); - string level = "Default"; - var matches = options.LogLevel.Keys.Where(k => context.StartsWith(k, StringComparison.OrdinalIgnoreCase)); - if (matches.Any()) - { - level = matches.Max(); - } - - return (Serilog.Events.LogEventLevel)Enum.Parse(typeof(Serilog.Events.LogEventLevel), options.LogLevel[level], true); + return options; } public static IWebHostBuilder UseClassifiedAdsLogger(this IWebHostBuilder builder, Func logOptions) @@ -129,7 +117,6 @@ public static IWebHostBuilder UseClassifiedAdsLogger(this IWebHostBuilder builde { logging.Configure(options => { - // options.ActivityTrackingOptions = ActivityTrackingOptions.SpanId | ActivityTrackingOptions.TraceId | ActivityTrackingOptions.ParentId; }); logging.AddAzureWebAppDiagnostics(); @@ -195,7 +182,6 @@ public static IHostBuilder UseClassifiedAdsLogger(this IHostBuilder builder, Fun { logging.Configure(options => { - // options.ActivityTrackingOptions = ActivityTrackingOptions.SpanId | ActivityTrackingOptions.TraceId | ActivityTrackingOptions.ParentId; }); logging.AddAzureWebAppDiagnostics(); @@ -263,8 +249,20 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt Directory.CreateDirectory(logsPath); var loggerConfiguration = new LoggerConfiguration(); + foreach (var logLevel in options.LogLevel) + { + var serilogLevel = ConvertToSerilogLevel(logLevel.Value); + + if (logLevel.Key == "Default") + { + loggerConfiguration.MinimumLevel.Is(serilogLevel); + continue; + } + + loggerConfiguration.MinimumLevel.Override(logLevel.Key, serilogLevel); + } + loggerConfiguration = loggerConfiguration - .MinimumLevel.Debug() .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithEnvironmentUserName() @@ -276,18 +274,7 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt .Enrich.WithExceptionDetails() .Filter.ByIncludingOnly((logEvent) => { - if (logEvent.Level >= options.File.MinimumLogEventLevel) - { - var sourceContext = logEvent.Properties.ContainsKey("SourceContext") - ? logEvent.Properties["SourceContext"].ToString() - : null; - - var logLevel = GetLogLevel(sourceContext, options); - - return logEvent.Level >= logLevel; - } - - return false; + return true; }) .WriteTo.File(Path.Combine(logsPath, "log.txt"), formatProvider: CultureInfo.InvariantCulture, @@ -302,15 +289,30 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt { loggerConfiguration .WriteTo.AWSSeriLog(new AWSLoggerConfig(options.AwsCloudWatch.LogGroup) - { - LogStreamName = options.AwsCloudWatch.LogStreamNamePrefix, - Region = options.AwsCloudWatch.Region, - Credentials = new BasicAWSCredentials(options.AwsCloudWatch.AccessKey, options.AwsCloudWatch.SecretKey), - }, + { + LogStreamName = options.AwsCloudWatch.LogStreamNamePrefix, + Region = options.AwsCloudWatch.Region, + Credentials = new BasicAWSCredentials(options.AwsCloudWatch.AccessKey, options.AwsCloudWatch.SecretKey), + }, iFormatProvider: null, textFormatter: new JsonFormatter()); } Log.Logger = loggerConfiguration.CreateLogger(); } + + private static LogEventLevel ConvertToSerilogLevel(LogLevel logLevel) + { + return logLevel switch + { + LogLevel.Trace => LogEventLevel.Verbose, + LogLevel.Debug => LogEventLevel.Debug, + LogLevel.Information => LogEventLevel.Information, + LogLevel.Warning => LogEventLevel.Warning, + LogLevel.Error => LogEventLevel.Error, + LogLevel.Critical => LogEventLevel.Fatal, + LogLevel.None => LogEventLevel.Fatal, + _ => LogEventLevel.Fatal + }; + } } diff --git a/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs b/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs index ff490b065..f558555be 100644 --- a/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs +++ b/src/Monolith/ClassifiedAds.Infrastructure/Logging/LoggingOptions.cs @@ -1,11 +1,12 @@ -using Serilog.Events; +using Microsoft.Extensions.Logging; +using Serilog.Events; using System.Collections.Generic; namespace ClassifiedAds.Infrastructure.Logging; public class LoggingOptions { - public Dictionary LogLevel { get; set; } + public Dictionary LogLevel { get; set; } public FileOptions File { get; set; }