Beispiel #1
0
        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>());
        }
Beispiel #2
0
 public LoggingMiddleware(ILogger <LoggingMiddleware> logger, LoggingMiddlewareSettings settings)
 {
     _logger   = logger ?? throw new ArgumentNullException(nameof(logger));
     _settings = settings ?? throw new ArgumentNullException(nameof(settings));
 }