public static IServiceCollection AddHttpContextLogging(this IServiceCollection collection, LoggingMiddlewareSettings settings = null) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } return(collection .AddSingleton(settings ?? new LoggingMiddlewareSettings()) .AddSingleton <LoggingMiddleware>()); }
public LoggingMiddleware(ILogger <LoggingMiddleware> logger, LoggingMiddlewareSettings settings) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _settings = settings ?? throw new ArgumentNullException(nameof(settings)); }