Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Latest commit

 

History

History
27 lines (19 loc) · 755 Bytes

README.md

File metadata and controls

27 lines (19 loc) · 755 Bytes

SerilogWeb.Owin

Discontinued

This package has been discontinued due to the very minimal amount of code required to do this directly; to attach RequestId to Owin requests:

1. Enable LogContext

In your Serilog configuration, add Enrich.FromLogContext():

Log.Logger = new LoggerConfiguration()
    .Enrich.FromLogContext()
    // Other sink configuration etc.

2. Add the following Owin middleware

app.Use(new Func<AppFunc, AppFunc>(next => (async env =>
{
    using (LogContext.PushProperty("RequestId", Guid.NewGuid()))
        await next.Invoke(env);
})));

(For other ways to add middleware to Owin apps, see this post.