using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; namespace FastGithub.Scanner.Middlewares { [Service(ServiceLifetime.Singleton)] sealed class ScanOkLogMiddleware : IGithubScanMiddleware { private readonly ILogger logger; public ScanOkLogMiddleware(ILogger logger) { this.logger = logger; } public Task InvokeAsync(GithubContext context, Func next) { if (context.HttpElapsed != null) { this.logger.LogInformation(context.ToString()); } return next(); } } }