public static IApplicationBuilder UseLogger(this IApplicationBuilder builder, LoggerOptions options = null) { // extension - use app.UseMyLogger(); if (options == null) { options = new LoggerOptions(); } return(builder.UseMiddleware <Logger>(Options.Create <LoggerOptions>(options))); }
/// <summary> /// Constructor /// </summary> /// <param name="next">RequestDelegate</param> /// <param name="options">LoggerOptions</param> public Logger(RequestDelegate next, IOptions <LoggerOptions> options) { // save for later _next = next; _options = options?.Value; if (_options == null) { // use default _options = new LoggerOptions(); } }
public Logger(RequestDelegate next, IOptions <LoggerOptions> options) { // save for later _next = next; _options = options.Value; }