Пример #1
0
        public void Configure(IApplicationBuilder app)
        {
            var log = ConfigureLogger();

            app.UseOwin(buildFunc =>
            {
                buildFunc(next => GlobalErrorLogging.Middleware(next, log));
                buildFunc(next => CorrelationToken.Middleware(next));
                buildFunc(next => RequestLogging.Middleware(next, log));
                buildFunc(next => PerformanceLogging.Middleware(next, log));
                buildFunc(next => new MonitoringMiddleware(next, HealthCheck).Invoke);
                buildFunc.UseNancy(opt => opt.Bootstrapper = new Bootstrapper(log));
            });
        }
Пример #2
0
        public void Catch_and_log_unhandled_exception()
        {
            using (TestCorrelator.CreateContext())
            {
                AppFunc pipelineFunc(AppFunc next) => GlobalErrorLogging.Middleware(next, m_Logger);

                var ctx = SetupOwinTestEnvironment(ErrorPath);

                var pipeline = pipelineFunc(m_TestModule(m_NoOp, m_Logger));
                var env      = ctx.Environment;
                pipeline(env);

                var msg = TestCorrelator.GetLogEventsFromCurrentContext().Should().ContainSingle();
                msg.Which.Level.Should().Be(LogEventLevel.Error);
            }
        }
Пример #3
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseCors("Cors");

            Logger log = ConfigurationLogger();

            app.UseOwin(buildFunc =>
            {
                buildFunc(next => GlobalErrorLogging.Middleware(next, log));
                buildFunc(next => CorrelationToken.Middleware(next));
                buildFunc(next => RequestLogging.Middleware(next, log));
                buildFunc(next => PerformanceLogging.Middleware(next, log));
                buildFunc(next => new MonitoringMiddleware(next, HealthCheck).Invoke);
                buildFunc.UseNancy(opt => opt.Bootstrapper = new CustomBootstrapper());
            });
        }