private static void ApplyGlobalAfterHook(IApplicationBuilder builder, BotwinOptions options) { if (options?.After != null) { builder.Use(async(ctx, next) => { await next(); await options.After(ctx); }); } }
private static void ApplyGlobalAfterHook(IApplicationBuilder builder, BotwinOptions options) { if (options?.After != null) { builder.Use(async(ctx, next) => { var loggerFactory = ctx.RequestServices.GetService <ILoggerFactory>(); var logger = loggerFactory.CreateLogger("Botwin.GlobalAfterHook"); await next(); logger.LogTrace("Executing global after hook"); await options.After(ctx); }); } }