Я хочу использовать пакет nuget AWS.Logger.AspNetCore для реализации Ведение журнала ядра ASP.NET в приложении ASP.NET Core 2.0 Razor Pages.
Примеры на сайте проекта основаны на ASP.NET Core 1.0.
Итак, примеры показывают:
В файле appsettings.json:
"AWS.Logging": {
"Region": "us-east-1",
"LogGroup": "AspNetCore.WebSample",
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
и в Startup.cs
public Startup(IHostingEnvironment env)
{
// Read the appsetting.json file for the configuration details
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
// Create a logging provider based on the configuration information passed through the appsettings.json
loggerFactory.AddAWSProvider(this.Configuration.GetAWSLoggingConfigSection());
...
Может кто-нибудь показать аналогичный в ASP.NET Core 2.0?И как затем внедрить регистратор в страницу кода Razor (.cshtml.cs)?(Я использую ASP.NET Core Razor Pages, а не MVC)
Я посмотрел на страницу от Microsoft по входу в систему в ASP.NET Core , на которой показано, как добавлять поставщиков, но яне могу понять, как связать это с добавлением AWS Logger в Startup.cs