serilog-web / classic

[Discontinued] Serilog web request logging and enrichment for classic ASP.NET applications
Apache License 2.0
79 stars 32 forks source link

How to write own local Enrichers #36

Closed kurosch closed 7 years ago

kurosch commented 7 years ago

Hello,

I was trying to extend the existing enrichers for specific ones we need for our logging and realized that this is not possible due to HttpContextCurrent being an internal class.

So I was wondering how to write custom Enrichers?

For example we need to extract a specific cookie and log it as well.

I do not mind sending PR for the Enrichers, however a different solution to the problem would be appreciated.

nblumhardt commented 7 years ago

Hi @kurosch - HttpContextCurrent is just a thin wrapper for HttpContext.Current from ASP.NET. You should be able to use it directly in your custom enricher.

kurosch commented 7 years ago

Thank you for clarification.