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

[Discontinued] Serilog web request logging and enrichment for the Owin pipeline

License

Notifications You must be signed in to change notification settings

serilog-web/owin

Repository files navigation

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.

About

[Discontinued] Serilog web request logging and enrichment for the Owin pipeline

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published