small naming fix
This commit is contained in:
parent
fefd348930
commit
1b6128f52a
@ -41,13 +41,13 @@ namespace FarmmapsApi
|
|||||||
.AddHttpClient<FarmmapsApiService>()
|
.AddHttpClient<FarmmapsApiService>()
|
||||||
.AddHttpMessageHandler<FarmmapsAuthenticationHandler>()
|
.AddHttpMessageHandler<FarmmapsAuthenticationHandler>()
|
||||||
.Services;
|
.Services;
|
||||||
|
|
||||||
Configure(serviceCollection);
|
Configure(serviceCollection);
|
||||||
|
|
||||||
var serviceProvider = serviceCollection.BuildServiceProvider();
|
var serviceProvider = serviceCollection.BuildServiceProvider();
|
||||||
|
|
||||||
ConfigureLogger(serviceProvider);
|
ConfigureLogger(serviceProvider);
|
||||||
|
|
||||||
await serviceProvider.GetService<FarmmapsApiService>().AuthenticateAsync();
|
await serviceProvider.GetService<FarmmapsApiService>().AuthenticateAsync();
|
||||||
// await serviceProvider.GetService<FarmmapsEventHub>().StartEventHub();
|
// await serviceProvider.GetService<FarmmapsEventHub>().StartEventHub();
|
||||||
|
|
||||||
@ -55,20 +55,20 @@ namespace FarmmapsApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void Configure(IServiceCollection serviceCollection);
|
protected abstract void Configure(IServiceCollection serviceCollection);
|
||||||
|
|
||||||
private static void ConfigureLogger(IServiceProvider serviceProvider)
|
private static void ConfigureLogger(IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
var isService = Matching.FromSource("Microsoft");
|
var isMicrosoftNamespace = Matching.FromSource("Microsoft");
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
.MinimumLevel.Information()
|
.MinimumLevel.Information()
|
||||||
.WriteTo.Logger(l => l.Filter.ByIncludingOnly(isService)
|
.WriteTo.Logger(l => l.Filter.ByIncludingOnly(isMicrosoftNamespace)
|
||||||
.WriteTo.Console(LogEventLevel.Warning))
|
.WriteTo.Console(LogEventLevel.Warning))
|
||||||
.WriteTo.File(path: "Logs/log.log", rollingInterval: RollingInterval.Day)
|
.WriteTo.File(path: "Logs/log.log", rollingInterval: RollingInterval.Day)
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
|
||||||
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
|
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
|
||||||
loggerFactory.AddSerilog();
|
loggerFactory.AddSerilog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user