Beispiel #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));
            });
        }
Beispiel #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);
            }
        }
Beispiel #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());
            });
        }