Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager committed Feb 23, 2024
1 parent 8fd23bc commit 3962b95
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Nager.PublicSuffixService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
builder.Services.AddSingleton<IRuleProvider, CachedHttpRuleProvider>();
builder.Services.AddSingleton<IDomainParser, DomainParser>();
builder.Services.AddScoped<GitHubClient>();

builder.Services.AddMemoryCache();

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
Expand All @@ -37,6 +38,11 @@
configuration.SerializerOptions.Converters.Add(new JsonStringEnumConverter());
});

var logger = LoggerFactory.Create(config =>
{
config.AddConsole();
}).CreateLogger("Program");

var app = builder.Build();

var ruleProvider = app.Services.GetService<IRuleProvider>();
Expand All @@ -58,6 +64,8 @@
{
domain = HttpUtility.UrlEncode(domain);
logger.LogInformation($"Get DomainInfo for {domain}");
var domainInfo = domainParser.Parse(domain);
return domainInfo;
})
Expand Down

0 comments on commit 3962b95

Please sign in to comment.