serilog-contrib / serilog-enrichers-clientinfo

Enrich logs with client IP, correlation id and HTTP request headers.
MIT License
93 stars 20 forks source link

added optional `propertyName` argument to `WithRequestHeader` #25

Closed pawan-regoti closed 1 year ago

pawan-regoti commented 1 year ago

as of now, there is no way to specify the property name for WithRequestHeader extension. it can be easily implemented using code changes in this pull request

{
  "Serilog": {
    "MinimumLevel": "Debug",
    "Using":  [ "Serilog.Enrichers.ClientInfo" ],
    "Enrich": [
      {
        "Name": "WithRequestHeader",
        "Args": {
          "headerName": "Content-Length",
          "propertyName": "RequestLength"
        }
      }
    ],
  }
mo-esmp commented 1 year ago

@pawan-regoti Thanks for the PR, I'll review and merge it soon.