Fix logging in SingleFile setup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Runtime;
|
||||
using Serilog;
|
||||
using Serilog.Exceptions;
|
||||
using Serilog.Settings.Configuration;
|
||||
using SPTarkov.Common.Semver;
|
||||
using SPTarkov.Common.Semver.Implementations;
|
||||
using SPTarkov.DI;
|
||||
@@ -94,25 +95,22 @@ public static class Program
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Configuration.SetBasePath(Directory.GetCurrentDirectory());
|
||||
|
||||
if (ProgramStatics.DEBUG())
|
||||
{
|
||||
builder.Configuration.AddJsonFile("appsettings.Development.json", true, true);
|
||||
builder.Configuration.AddJsonFile("./appsettings.Development.json", true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Configuration.AddJsonFile("appsettings.json", true, true);
|
||||
builder.Configuration.AddJsonFile("./appsettings.json", true, true);
|
||||
}
|
||||
|
||||
builder.Host.UseSerilog((context, provider, logger) =>
|
||||
{
|
||||
logger
|
||||
.ReadFrom.Configuration(context.Configuration)
|
||||
.ReadFrom.Services(provider)
|
||||
.Enrich.FromLogContext()
|
||||
.Enrich.WithExceptionDetails()
|
||||
.Enrich.WithThreadName()
|
||||
.Enrich.WithThreadId();
|
||||
.ReadFrom.Services(provider);
|
||||
});
|
||||
|
||||
return builder;
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
"Serilog.Sinks.File"
|
||||
"Serilog.Sinks.File",
|
||||
"Serilog.Sinks.Async",
|
||||
"Serilog.Settings.Configuration",
|
||||
"Serilog.Expressions",
|
||||
"Serilog.Exceptions",
|
||||
"Serilog.Enrichers.Context",
|
||||
"Serilog.Enrichers.Thread"
|
||||
],
|
||||
"MinimumLevel": {
|
||||
"Default": "Verbose",
|
||||
|
||||
@@ -2,12 +2,18 @@
|
||||
"Serilog": {
|
||||
"Using": [
|
||||
"Serilog.Sinks.Console",
|
||||
"Serilog.Sinks.File"
|
||||
"Serilog.Sinks.File",
|
||||
"Serilog.Sinks.Async",
|
||||
"Serilog.Settings.Configuration",
|
||||
"Serilog.Expressions",
|
||||
"Serilog.Exceptions",
|
||||
"Serilog.Enrichers.Context",
|
||||
"Serilog.Enrichers.Thread"
|
||||
],
|
||||
"MinimumLevel": {
|
||||
"Default": "Verbose",
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Verbose"
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
|
||||
Reference in New Issue
Block a user