small naming fix

This commit is contained in:
Mark van der Wal 2021-04-19 13:16:33 +02:00
parent fefd348930
commit 1b6128f52a

View File

@ -41,13 +41,13 @@ namespace FarmmapsApi
.AddHttpClient<FarmmapsApiService>()
.AddHttpMessageHandler<FarmmapsAuthenticationHandler>()
.Services;
Configure(serviceCollection);
var serviceProvider = serviceCollection.BuildServiceProvider();
ConfigureLogger(serviceProvider);
await serviceProvider.GetService<FarmmapsApiService>().AuthenticateAsync();
// await serviceProvider.GetService<FarmmapsEventHub>().StartEventHub();
@ -55,20 +55,20 @@ namespace FarmmapsApi
}
protected abstract void Configure(IServiceCollection serviceCollection);
private static void ConfigureLogger(IServiceProvider serviceProvider)
{
var isService = Matching.FromSource("Microsoft");
var isMicrosoftNamespace = Matching.FromSource("Microsoft");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.WriteTo.Logger(l => l.Filter.ByIncludingOnly(isService)
.WriteTo.Logger(l => l.Filter.ByIncludingOnly(isMicrosoftNamespace)
.WriteTo.Console(LogEventLevel.Warning))
.WriteTo.File(path: "Logs/log.log", rollingInterval: RollingInterval.Day)
.CreateLogger();
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
loggerFactory.AddSerilog();
}
}
}
}