Пример #1
0
        public async Task Invoke(HttpContext httpContext, IActionDescriptorCollectionProvider actionsDescriber)
        {
            await next(httpContext);

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            Task.Run(async() =>
            {
                if (actionsDescriber.ActionDescriptors.Version > LastLoggedVersion)
                {
                    LastLoggedVersion = actionsDescriber.ActionDescriptors.Version;

                    log.Log(LogLevel, 0, actionsDescriber.ActionDescriptors, null,
                            (a, e) => $"{actionsDescriber.GetType()}.ActionDescriptors.Version={a.Version}. Actions.Count={a.Items.Count}");

                    foreach (var action in actionsDescriber.ActionDescriptors.Items)
                    {
                        log.Log(LogLevel, 0, action, null, InspectAndFormat);
                    }
                }
            });
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }