improved logging again

This commit is contained in:
Mark van der Wal 2021-04-19 14:03:43 +02:00
parent 1b6128f52a
commit e7de64d04c

View File

@ -59,11 +59,15 @@ namespace FarmmapsApi
private static void ConfigureLogger(IServiceProvider serviceProvider)
{
var isMicrosoftNamespace = Matching.FromSource("Microsoft");
var isSystem = Matching.FromSource("System");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.WriteTo.Logger(l => l.Filter.ByIncludingOnly(isMicrosoftNamespace)
.WriteTo.Console(LogEventLevel.Warning))
.MinimumLevel.Verbose()
.WriteTo.Logger(l =>
l.WriteTo.Logger(l2 => l2
.Filter.ByExcluding(v => isMicrosoftNamespace(v) || isSystem(v))
.WriteTo.Console())
)
.WriteTo.File(path: "Logs/log.log", rollingInterval: RollingInterval.Day)
.CreateLogger();