public static IApplicationBuilder UseRequestLogger(this IApplicationBuilder builder, RequestLoggerOptions options = null)
        {
            // extension - use app.UseRequestLogger();
            if (options == null)
            {
                options = new RequestLoggerOptions();
            }

            return(builder.UseMiddleware <RequestLogger>(Options.Create <RequestLoggerOptions>(options)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RequestLogger"/> class.
        /// </summary>
        /// <param name="next">RequestDelegate</param>
        /// <param name="options">LoggerOptions</param>
        public RequestLogger(RequestDelegate next, IOptions <RequestLoggerOptions> options)
        {
            // save for later
            this.next    = next;
            this.options = options?.Value;

            if (this.options == null)
            {
                // use default
                this.options = new RequestLoggerOptions();
            }
        }