diff --git a/FastGithub/FastGithub.csproj b/FastGithub/FastGithub.csproj index eae11ca..c6d63a6 100644 --- a/FastGithub/FastGithub.csproj +++ b/FastGithub/FastGithub.csproj @@ -20,6 +20,12 @@ + + + + + + PreserveNewest diff --git a/FastGithub/Program.cs b/FastGithub/Program.cs index 26449db..484e2ce 100644 --- a/FastGithub/Program.cs +++ b/FastGithub/Program.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; +using Serilog; using System; using System.IO; @@ -55,6 +56,13 @@ namespace FastGithub kestrel.ListenHttpReverseProxy(); kestrel.ListenGithubSshProxy(); }); + webBuilder.UseSerilog((hosting, logger) => + { + logger + .ReadFrom.Configuration(hosting.Configuration) + .Enrich.FromLogContext() + .WriteTo.Console(outputTemplate: "{Timestamp:O} [{Level:u3}]{NewLine}{SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}"); + }); }); } } diff --git a/FastGithub/appsettings.json b/FastGithub/appsettings.json index 8f8515d..60f4d4a 100644 --- a/FastGithub/appsettings.json +++ b/FastGithub/appsettings.json @@ -31,13 +31,15 @@ } } }, - "Logging": { - "LogLevel": { + "Serilog": { + "MinimumLevel": { "Default": "Information", - "Yarp": "Warning", - "System": "Warning", - "Microsoft": "Warning", - "Microsoft.AspNetCore.Server.Kestrel": "Error" + "Override": { + "Yarp": "Warning", + "System": "Warning", + "Microsoft": "Warning", + "Microsoft.AspNetCore.Server.Kestrel": "Error" + } } } }