diff --git a/Examples/Examples.csproj b/Examples/Examples.csproj index 47352d2..67491f6 100644 --- a/Examples/Examples.csproj +++ b/Examples/Examples.csproj @@ -20,6 +20,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Examples/Program.cs b/Examples/Program.cs index 0a553e6..f46a79f 100644 --- a/Examples/Program.cs +++ b/Examples/Program.cs @@ -8,7 +8,10 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Configuration; - +using Humanizer.Configuration; +using Serilog; +using Serilog.Exceptions; +using Serilog.Exceptions.Core; namespace Examples { internal class Program @@ -43,6 +46,22 @@ await Host.CreateDefaultBuilder(args) services.AddHostedService(); }) + .ConfigureLogging(logBuilder => + { + var logConfig = new LoggerConfiguration() + .MinimumLevel.Debug() + .MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Information) + .Enrich.FromLogContext() + .Enrich.WithExceptionDetails() + .Enrich.WithProperty("App", Environment.GetCommandLineArgs()[0]) + //.Enrich.WithMachineName() + .Enrich.WithExceptionDetails(new DestructuringOptionsBuilder().WithDefaultDestructurers()) + .WriteTo.Console(); + + Log.Logger = logConfig.CreateLogger(); + + }) + .Build() .RunAsync(); }