Skip to content

Enrich Serilog log events with properties from the current HttpContext.

License

Notifications You must be signed in to change notification settings

ekmsystems/serilog-enrichers-http-context-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serilog.Enrichers.HttpContextInfo

Enrich Serilog log events with properties from the current HttpContext.

Build status Coverage Status NuGet

To use the enricher, first install the NuGet package:

Install-Package Serilog.Enrichers.HttpContextInfo

Then, apply the enricher to your LoggerConfiguration:

Log.Logger = new LoggerConfiguration()
    .Enrich.WithRequest()
    // ...other configuration...
    .CreateLogger();

The WithRequest() enricher will add the current HttpRequest properties to produced events.

Included enrichers

The package includes:

  • WithRequest() - adds the HttpRequest from the current HttpContext.
  • WithResponse() - adds the HttpResponse from the current HttpContext.

About

Enrich Serilog log events with properties from the current HttpContext.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages