コード例 #1
0
        protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);
            pipelines.OnError.AddItemToEndOfPipeline((ctx, ex) => {
                Logger.Error(ex, "Unhandled Exception in CodeSaw.Web");
                return(ctx.Response);
            });

            pipelines.AddToLogContext(new Dictionary <string, Func <NancyContext, object> >
            {
                ["api.user"] = ctx => ctx.CurrentUser?.Identity?.Name,
                ["api.url"]  = ctx => ctx.Request.Url.ToString(),
            });
        }