Example #1
0
        public static IApplicationBuilder UsePerformanceLog(this IApplicationBuilder app, Action <IPerformanceLogOptions> optionsAction)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (optionsAction == null)
            {
                throw new ArgumentNullException(nameof(optionsAction));
            }
            var options = new PerformanceLogOptions();

            optionsAction.Invoke(options);

            return(app.UseMiddleware <PerformanceLogMiddleware>(options));
        }
Example #2
0
        public static IApplicationBuilder UsePerformanceLog(this IApplicationBuilder app, PerformanceLogOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.UseMiddleware <PerformanceLogMiddleware>(options));
        }
 public PerformanceLogMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, PerformanceLogOptions options)
 {
     _next          = next;
     _loggerFactory = loggerFactory;
     _options       = options;
 }