diff --git a/SocialGuard.Api/Program.cs b/SocialGuard.Api/Program.cs index c06e443..e03a5ee 100644 --- a/SocialGuard.Api/Program.cs +++ b/SocialGuard.Api/Program.cs @@ -50,6 +50,6 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup()) - .UseSerilog(); + .UseSerilog((hostingCtx, config) => config.ReadFrom.Configuration(hostingCtx.Configuration)); } } diff --git a/SocialGuard.Api/appsettings.Development.json b/SocialGuard.Api/appsettings.Development.json index 7d5732e..fa32807 100644 --- a/SocialGuard.Api/appsettings.Development.json +++ b/SocialGuard.Api/appsettings.Development.json @@ -1,10 +1,24 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } + "Serilog": { + "Using": [ + "Serilog.Sinks.Console" + ], + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "Enrich": [ + "FromLogContext", + "WithAssemblyName" + ], + "WriteTo": [ + { + "Name": "Console" + } + ] }, "MongoDatabase": { diff --git a/SocialGuard.Api/appsettings.json b/SocialGuard.Api/appsettings.json index c3ec507..29b5352 100644 --- a/SocialGuard.Api/appsettings.json +++ b/SocialGuard.Api/appsettings.json @@ -1,11 +1,26 @@ { - "Logging": { - "LogLevel": { + "Serilog": { + "Using": [ + "Serilog.Sinks.Console" + ], + "MinimumLevel": { "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } + "Override": { + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "Enrich": [ + "FromLogContext", + "WithAssemblyName" + ], + "WriteTo": [ + { + "Name": "Console" + } + ] }, + "AllowedHosts": "*", "MongoDatabase": {